js点击放烟花烟花绽放动画效果代码

代码语言:html

所属分类:粒子

代码描述:js点击放烟花烟花绽放动画效果代码

代码标签: 烟花 烟花 绽放 动画 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <style type="text/css">



        html,body {
            height: 100%;
            margin: 0;
            padding: 0
        }



        ul,li {
            text-indent: 0;
            text-decoration: none;
            margin: 0;
            padding: 0
        }



        img {
            border: 0
        }



        body {
            background-color: #000;
            color: #999;
            font: 100%/18px helvetica, arial, sans-serif
        }



        canvas {
            cursor: crosshair;
            display: block;
            left: 0;
            position: absolute;
            top: 0;
            z-index: 20
        }



        #header img {
            width: 100%;
            height: 20%;
        }



        #bg img {
            width: 100%;
            height: 80%;
        }



        #header,#bg {
            position: fixed;
            left: 0;
            right: 0;
            z-index: 10
        }



        #header {
            top: 0
        }



        #bg {
            position: fixed;
            z-index: 1;
        }



        audio {
            position: fixed;
            display: none;
            bottom: 0;
            left: 0;
            right: 0;
            width: 100%;
            z-index: 5
        }


        body {
            background: url(//repo.bfw.wiki/bfwrepo/image/604a26e01dd36.png) no-repeat;
            background-size: cover;
        }


    </style>

</head>



<body>



    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script>

    <script type="text/javascript">

        $(function() {

            var Fireworks = function() {

                var self = this;

                var rand = function(rMi, rMa) {
                    return ~~((Math.random()*(rMa-rMi+1))+rMi);
                }

                var hitTest = function(x1, y1, w1, h1, x2, y2, w2, h2) {
                    return !(x1 + w1 < x2 || x2 + w2 < x1 || y1 + h1 < y2 || y2 + h2 < y1);
                };

                window.requestAnimFrame = function() {
                    return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(a) {
                        window.setTimeout(a, 1E3/60)}}();



                self.init = function() {

.........完整代码请登录后点击上方下载按钮下载查看

网友评论0