码迷,mamicode.com
首页 > Web开发 > 详细

纯CSS实现放烟花效果

时间:2020-06-11 16:52:00      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:lock   ado   view   www   inline   line   ram   绑定   https   

本文出自:https://www.cnblogs.com/2186009311CFF/p/13093596.html

用元素绑定一个class

<view  class="fireWorkBox"></view>

class对应的css如下

.fireWorkBox {
        content: ‘‘;
        width: 10upx;
        height: 10upx;
        display: inline-block;
        // box-shadow: 10upx     0upx 0 #FF00FF, 
        //             40upx   -30upx 0 #FF7F50, 70upx   -10upx 0 #00FFFF, 130upx -20upx 0 #9932CC, 230upx   0 0 #00FFFF,
        //             80upx   -70upx 0 #00FF00,100upx   -40upx 0 #FF00FF, 190upx -30upx 0 #FF00FF,
        //             130upx -110upx 0 #FF00FF,150upx   -60upx 0 #ADFF2F,
        //             200upx  -80upx 0 #00FFFF, 
        //             250upx  -30upx 0 #FF7F50, 
        //             280upx   20upx 0 #FF00FF,
                    
        //             -10upx     0upx 0 #FF00FF,
        //             -40upx   -30upx 0 #FF7F50, -70upx   -10upx 0 #00FFFF,-130upx -20upx 0 #9932CC, -230upx   0 0 #00FFFF,
        //             -80upx   -70upx 0 #00FF00,-100upx   -40upx 0 #FF00FF, -190upx -30upx 0 #FF00FF,
        //             -130upx -110upx 0 #FF00FF,-150upx   -60upx 0 #ADFF2F,
        //             -200upx  -80upx 0 #00FFFF, 
        //             -250upx  -30upx 0 #FF7F50, 
        //             -280upx   20upx 0 #FF00FF;
        animation-name: fireWork;
        animation-duration: 1s;
        animation-iteration-count: infinite;
    }

    @keyframes fireWork {
        from {
            box-shadow: none;
        }

        10% {
            box-shadow: 10upx     0upx 0 #FF00FF, -10upx     0upx 0 #FF00FF;
        }

        20% {
            box-shadow: 40upx   -30upx 0 #FF7F50, 70upx   -10upx 0 #00FFFF, 130upx -20upx 0 #9932CC, 230upx   0 0 #00FFFF,
                    -40upx   -30upx 0 #FF7F50, -70upx   -10upx 0 #00FFFF,-130upx -20upx 0 #9932CC, -230upx   0 0 #00FFFF;
        }

        30% {
            box-shadow: 
                    80upx   -70upx 0 #00FF00,100upx   -40upx 0 #FF00FF, 190upx -30upx 0 #FF00FF,
                    -80upx   -70upx 0 #00FF00,-100upx   -40upx 0 #FF00FF, -190upx -30upx 0 #FF00FF;
        }

        40% {
            box-shadow:130upx -110upx 0 #FF00FF,150upx   -60upx 0 #ADFF2F,
                      -130upx -110upx 0 #FF00FF,-150upx   -60upx 0 #ADFF2F;
        }

        70% {
            box-shadow: 200upx  -80upx 0 #00FFFF, 
                    -200upx  -80upx 0 #00FFFF;
        }

        80% {
            box-shadow: 250upx  -30upx 0 #FF7F50, 
                       -250upx  -30upx 0 #FF7F50;
        }

        90% {
            box-shadow:280upx   20upx 0 #FF00FF,
                      -280upx   20upx 0 #FF00FF;
        }
    }

点状轨迹如下图所示:

技术图片

 

纯CSS实现放烟花效果

标签:lock   ado   view   www   inline   line   ram   绑定   https   

原文地址:https://www.cnblogs.com/2186009311CFF/p/13093596.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!