javascript - 一个动画效果
ringa_lee
ringa_lee 2017-04-11 12:02:32
[JavaScript讨论组]

这个动画效果怎么写

ringa_lee
ringa_lee

ringa_lee

全部回复(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>
  <p id="an"></p>
</body>
PHPz

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

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号