当前位置:网站首页>Page dynamics [2]keyframes
Page dynamics [2]keyframes
2022-07-03 16:09:00 【King of the devil】
CSS Dynamic effect
@keyframes yes transition Upgraded version . Compared with transition, Intermediate processes can be defined , You can also set cycle playback and so on .
For basic usage , No more narratives .
Next, we will first introduce the time function of animation .
function
General , When animating, you can choose the motion curve of the animation .
ease
ease In fact, it is the preset Bezier curve . You can define common motion curves .
ease,liner,ease-in,ease-out,ease-in-out
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-YPGFG8W7-1644808716437)(…/assets/easeCompe.gif)]
cubic-bezier()
Three Bessel curves , It is a function controlled by mathematical formula .
cubic-bezier(x1,y1,x2,y2)
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-PtDxxqYE-1644808716438)(…/assets/bezier.PNG)]
(x1,y1,x2,y2) Represents two handles , Control the animation motion curve .
The following website can adjust the appropriate Bessel curve by itself
https://cubic-bezier.com/
step
Stepping The way of is common in sequence frames ,
When playing a sequence frame , You can set the pictures of the sequence as the background , Then move the position of the background picture , Achieve an animated effect .
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-NXmz3rUq-1644808716439)(…/assets/ Sequence frame .jpg)]
Move the background image by stepping , You can make the sequence frame move .
transform
In the process of animation , The most common attribute is transform. Let's introduce transform Main points .
GPU Speed up
Optimize animation , You need to reduce page redrawing and rearrangement .
The biggest impact on performance is to change the width and height of elements without breaking away from the document flow , Animation such as position movement . This will affect most other elements .
Generally speaking , Only use on the elements that need to be transformed transform To transform, you can reduce the consumption of performance .
transform3d
transform3d The most important thing is perspective , Perspective is not set , Just like the ordinary transform There's no difference .
perspective It is used to set the viewing position of perspective .
Here are the elements rotateX(45deg) Result , One has no settings perspective, One set .
matrix(a, b, c, d, tx, ty)
stay transform in , have access to matrix To transform . Through matrix operation , To change the position and size .
$$\begin{bmatrix}
a&c&e\
b&d&f\
0&0&1\
\end{bmatrix}
.
\begin{bmatrix}
x\
y\
1\
\end{bmatrix}
\begin{bmatrix}
ax + cy + tx\
bx + dy + ty\
1\
\end{bmatrix}
$$
The formula of matrix transformation is :
x = ax + cy + tx
y = bx + dy + ty
above ;
x,y After calculation , Is the position after the transformation .
When translation is needed , You can set matrix(1, 0, 0, 1, tx, ty)
At this time , The operation becomes :
x = x + tx
y = y + ty
tx and ty Is the value of Translation .
Other rotations , The zoom , wait , Both can pass matrix To set it up . Here is just a simple operation .
The zoom
matrix(sx,0,0,sy,0,0)
rotate
matrix(cosθ,sinθ,-sinθ,cosθ,0,0)
The tensile
matrix(1,tan(θy),tan(θx),1,0,0)
边栏推荐
- 分布式事务(Seata) 四大模式详解
- Batch files: list all files in a directory with relative paths - batch files: list all files in a directory with relative paths
- Go language self-study series | if else statement in golang
- Mongodb installation and basic operation
- Win32 create window and button (lightweight)
- 大csv拆分和合并
- About text selection in web pages and counting the length of selected text
- Pandora IOT development board learning (HAL Library) - Experiment 5 external interrupt experiment (learning notes)
- 使用AUR下载并安装常用程序
- Rk3399 platform development series explanation (WiFi) 5.54. What is WiFi wireless LAN
猜你喜欢
![App mobile terminal test [4] APK operation](/img/f1/4bff6e66b77d0f867bf7237019e982.png)
App mobile terminal test [4] APK operation

Stm32f103c8t6 firmware library lighting

远程文件包含实操

使用AUR下载并安装常用程序

Record a jar package conflict resolution process

请做好3年内随时失业的准备?
![[200 opencv routines] 217 Mouse interaction to obtain polygon area (ROI)](/img/04/460734209ec315c5c02cb3fae4bf0e.png)
[200 opencv routines] 217 Mouse interaction to obtain polygon area (ROI)

Remote file contains actual operation

“用Android复刻Apple产品UI”(2)——丝滑的AppStore卡片转场动画

MongoDB 的安装和基本操作
随机推荐
嵌入式开发:避免开源软件的7个理由
First knowledge of database
The difference between calling by value and simulating calling by reference
TCP拥塞控制详解 | 3. 设计空间
Location of software installation information and system services in the registry
Redis高可用与持久化
Pyinstaller is not an internal or external command, nor is it a runnable program or batch file
Get the executable path through the process PID (queryfullprocessimagename)
Reflection on some things
Nifi from introduction to practice (nanny level tutorial) - flow
Break through 1million, sword finger 2million!
MB10M-ASEMI整流桥MB10M
高等数学(第七版)同济大学 习题2-1 个人解答
The mixlab editing team is recruiting teammates~~
[200 opencv routines] 217 Mouse interaction to obtain polygon area (ROI)
From "zero sum game" to "positive sum game", PAAS triggered the third wave of cloud computing
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (4)
一些事情的反思
App mobile terminal test [5] file writing and reading
【Proteus仿真】74HC595+74LS154驱动显示16X16点阵