当前位置:网站首页>Animation effect
Animation effect
2022-07-24 06:29:00 【PS notes】
Call the animation effect with animation, Define animation with keyframes
The difference between animation effect and excessive effect :
animation-name: Specifies the keyframe name .
animation-duration: Specify the time it takes to complete the animation effect , In seconds .
animation-timing-function: Speed curve of specified animation
animation-delay: Specify the delay before the animation starts
animation-iteration-count: Specify the number of times the animation should be interrupted
@keyframes anim {0%{transform:translate(0px,0px)
}}
100%{
transform:translate(900px,100px)
}
Box rotation animation case :
animation: anim 2s linear 1s infinite Cycle all the time ;
animation: Animation name + How many seconds to complete +linear Excessive uniform speed + How many seconds + rotate 2 Time ( If you want to keep cycling infinite)
<style>
/* use keyframe Define an animation */
@keyframes anim{
0%{
transform: rotate(0deg);
}
100%{
transform: rotate(360deg);
}
}
.box{
width: 100px;
height: 100px;
background-color: red;
margin:100px auto;
/* animation: Animation name + How many seconds to complete +linear Excessive uniform speed + How many seconds + rotate 2 Time ( If you want to keep cycling infinite) */
animation: anim 2s linear 1s infinite;
}
</style>
</head>
<body>
<div class="box">hello</div>
</body>
</html>
Case study : According to % from 0-100 Set the corresponding changes between , As wide , high , Background color , etc. , One thing to pay attention to is the beginning 0% The width and height of should be the same as that of the end 100% Consistent width and height , In this way, the vision will be smoother , good-looking .
<style>
/* use keyframe Define an animation */
@keyframes anim{
0%{
transform: rotate(0deg);
}
20%{
width: 200px;
height: 200px;
transform: rotate(360deg);
}
40%{
background-color: yellow;
width: 300px;
height: 300px;
}
100%{
width: 100px;
height: 100px;
}
}
.box{
width: 100px;
height: 100px;
background-color: red;
margin:100px auto;
/* animation: Animation name + How many seconds to complete +linear Excessive uniform speed + How many seconds + rotate 2 Time ( If you want to keep cycling infinite) */
animation: anim 10s linear;
}
</style>
</head>
<body>
<div class="box">hello</div>
</body>
</html>=======================================================================
keyframes
1, Specify animation in percentage
2,from.....to..... Assign animation Which is the same thing as 0%-100%
Be careful : The beginning is the same as the end , It can make the animation smoother .
<style> /* use keyframe Define an animation */ @keyframes anim{ /* 0%{ transform: rotate(0deg); } 100%{ transform: rotate(360deg); } */ /* It can be written as follows */ form{ transform: rotate(0deg); } to{ transform: rotate(360deg); } } .box{ width: 100px; height: 100px; background-color: red; margin:100px auto; /* animation: Animation name + How many seconds to complete +linear Excessive uniform speed + How many seconds + rotate 2 Time ( If you want to keep cycling infinite) */ animation: anim 2s linear ; } </style> </head> <body> <div class="box">hello</div> </body> </html>
CD Rotation effect :
Stop Animation
animation-play-state:paused;
<style>
/* CD Rotation effect */
@keyframes anim {
form{
transform: rotate(0deg);
}
to{
transform: rotate(360deg);
}
}
.box{
height: 200px;
width: 200px;
margin: 100px auto;
border-radius: 50%;
overflow: hidden;
animation: anim 3s linear infinite;
}
.box img{
height: 200px;
width: 200px;
}
.box:hover{
animation-play-state:paused;
}
</style>
</head>
<body>
<audio src="" controls></audio>
<div class="box">
<img src="ppp.jpg" alt="">
</div>
</body>
</html>
Pirate bed effect case :
1, Complete the wave effect
2, Complete the effect of boat swing
3, Add the effect of fish
边栏推荐
- 迭代器与生成器
- Ia note 1
- IP job (1)
- Server hardware and RAID configuration practice
- Quickly and simply set up FTP server, and achieve public network access through intranet [no need for public IP]
- Leetcode sword finger offer jz42 maximum sum of continuous subarrays
- LVM与磁盘配额
- Custom MVC 1.0
- [218] what are the advantages and disadvantages of CS architecture and BS architecture and data on the server and client?
- 【214】什么是自动化框架
猜你喜欢

DHCP原理与配置

SSH远程访问及控制

Custom MVC 2.0
![[222] memory overflow and location](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[222] memory overflow and location

IP作业(6)

Summary of ten common vulnerabilities (principle, harm, defense)

How to build a website full of ritual sense and publish it on the public website 1-2

Mysql database - SQL summary (remember to pay attention to me! Come on in China!)

Process and planned task management

常用工作方法总结(7S、SWOT分析、PDCA循环、SMART原则、6W2H、时间管理、WBS、二八原则)
随机推荐
IP notes (6)
General paging 01
Interview questions for Test Manager / test team leader / Test Supervisor
Custom MVC 2.0
Do not rent a server, build your own personal business website (how to buy a domain name)
联合国农产品数据分析
mysql 忘记退出直接关闭窗口现在要删除整个文件夹如何删除
服务器硬件及RAID配置实战
IP课笔记(5)
IP lesson summary (3)
sed命令
【测试工具】
awk的使用
leetcode剑指offer JZ3 数组中重复的数字
go的环境搭建和起步
Windows下Mysql5.7忘记root密码解决方法
IP作业(6)
Data warehouse and data warehouse modeling
Leetcode剑指offer JZ9 双栈实现队列
IP class notes (5)