<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box{
width: 400px;
height: 400px;
background-image: linear-gradient(red,blue,#333,pink);
border-radius: 50%;
/* 调用 */
animation: a 1s infinite;
}
/* 定义 */
@keyframes a{
0%{
transform: translate(0,0);
}
20%{
transform: translate(1000px,0) rotateZ(1turn);
}
40%{
transform: translate(1000px,600px) rotateZ(8turn);
}
60%{
transform: translate(0,600px) rotateZ(12turn);
}
100%{
transform: translate(0,0px)rotateZ(24turn);
}
}
/* 注意点:动画是可以写多个字体,多个状态通过百分比进行描述,状态相同执行一次 */
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
动画多个方向移动+旋转状态
于 2022-10-05 20:02:17 首次发布