当前位置:网站首页>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)
边栏推荐
- Client does not support authentication protocol requested by server; consider upgrading MySQL client
- Jmeter线程组功能介绍
- 远程办公之大家一同实现合作编辑资料和开发文档 | 社区征文
- [combinatorics] combinatorial identity (sum of variable upper terms 1 combinatorial identity | summary of three combinatorial identity proof methods | proof of sum of variable upper terms 1 combinator
- Advanced Mathematics (Seventh Edition) Tongji University exercises 2-1 personal solutions
- [list to map] collectors Tomap syntax sharing (case practice)
- 用同花顺炒股开户安全吗?
- How to thicken the brush in the graphical interface
- The difference between RAR and zip files
- 关于网页中的文本选择以及统计选中文本长度
猜你喜欢
First knowledge of database
[proteus simulation] 74hc595+74ls154 drive display 16x16 dot matrix
Asemi rectifier bridge umb10f parameters, umb10f specifications, umb10f package
The accept attribute of the El upload upload component restricts the file type (detailed explanation of the case)
Embedded development: seven reasons to avoid open source software
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (I)
Distributed task scheduling XXL job
[redis foundation] understand redis persistence mechanism together (rdb+aof graphic explanation)
How to thicken the brush in the graphical interface
[web security] - [SQL injection] - error detection injection
随机推荐
【Proteus仿真】74HC595+74LS154驱动显示16X16点阵
pycharm错Error updating package list: connect timed out
Microservice API gateway
WinDbg analysis dump file
Why can't strings be directly compared with equals; Why can't some integers be directly compared with the equal sign
初试scikit-learn库
[proteus simulation] 8 × 8LED dot matrix screen imitates elevator digital scrolling display
Go语言自学系列 | golang switch语句
Go语言自学系列 | golang中的if else语句
Myopia: take off or match glasses? These problems must be understood clearly first
App mobile terminal test [5] file writing and reading
Initial test of scikit learn Library
Batch files: list all files in a directory with relative paths - batch files: list all files in a directory with relative paths
Pandora IOT development board learning (HAL Library) - Experiment 5 external interrupt experiment (learning notes)
Vs2017 is driven by IP debugging (dual machine debugging)
[系统安全] 四十三.Powershell恶意代码检测系列 (5)抽象语法树自动提取万字详解
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (III)
Backtracking method to solve batch job scheduling problem
Microservice sentinel flow control degradation
QT use qzxing to generate QR code