<!DOCTYPE html>
<html lang="en">
<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: 450px;
height: 450px;
margin: 100px auto;
}
.box1 {
height: 450px;
background-image: url(./2_2_2.png);
}
.animation1 {
animation: moveimg 4s linear;
}
@keyframes moveimg {
0% {
width: 0px;
}
50% {
width: 50%;
}
100% {
width: 100%;
}
}
</style>
</head>
<body>
<div class="box">
<div class="box1 animation1"></div>
</div>
</body>
</html>
css animation动画抖动
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
1条回答 默认 最新
··零·· 2022-04-12 15:10关注如果要无限重复动画的话,修改你的22行
.animation1 { animation-name: moveimg; animation-duration: 3s; animation-iteration-count: infinite; }上面只是宽度循环变化,如果换成图片总体放大循环 代码如下:
<!DOCTYPE html> <html lang="en"> <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: 450px; height: 450px; margin: 100px auto; } .box1 { height: 450px; position: relative; } .animation1 { animation-name: moveimg; animation-duration: 3s; animation-iteration-count: infinite; } @keyframes moveimg { 0% { transform: scale(0); } 50% { transform: scale(.5); } 100% { transform: scale(1); } } </style> </head> <body> <div class="box"> <div class="box1 "> <img class="animation1" src="./2_2_2.png"> </div> </div> </body> </html>解决 无用评论 打赏 举报 编辑记录