一个动画效果

clipboard.png

这个动画效果怎么写

阅读 1.9k
2 个回答
<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>
  <div id="an"></div>
</body>

我觉得关键是border-radius和width属性的变化,使用transition或animation对width属性进行动态设置。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题