扫码关注官方订阅号
这个动画效果怎么写
ringa_lee
<style> #an{ width: 100px; height: 100px; background-color: #0a628f; border-radius: 50%; animation: myfirst 5s; animation-iteration-count:infinite; } @keyframes myfirst { from {background: yellow;} 50%{ background-color: #000a28; -webkit-transform: translate(200px); -moz-transform: translate(200px); -ms-transform: translate(200px); -o-transform: translate(200px); transform: translate(200px); width: 200px; border-radius: 20px; } to { -webkit-transform: translate(300px); -moz-transform: translate(300px); -ms-transform: translate(300px); -o-transform: translate(300px); transform: translate(300px); width: 200px; height: 130px; border-radius: 20px; } } </style> <body> <p id="an"></p> </body>
我觉得关键是border-radius和width属性的变化,使用transition或animation对width属性进行动态设置。
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
我觉得关键是border-radius和width属性的变化,使用transition或animation对width属性进行动态设置。