jquery实现canvas彩色光束喷泉粒子线条喷射动画效果代码

代码语言:html

所属分类:粒子

代码描述:jquery实现canvas彩色光束喷泉粒子线条喷射动画效果代码

代码标签: jquery canvas 彩色 光束 喷泉 粒子 线条 喷射 动画

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

<!doctype html>
<html>
<head>
<meta charset="utf-8">

<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script>
<style>
html
, body{
       
width: 100%;
       
height: 100%;
       
margin: 0;
       
padding: 0;
       
overflow: hidden;
}
.container{
       
width: 100%;
       
height: 100%;
       
margin: 0;
       
padding: 0;
       
background-color: #000000;
}
</style>

</head>
<body>

<div id="jsi-fountain-container" class="container"></div>

<script>
var RENDERER = {
        GRAVITY : 0.05,
        BASE_RATE : 0.6,
        OFFSET_RATE : 1 / 50,
        PARTICLE_COUNT : 30,
       
        init : function(){
                this.setParameters();
                this.setup();
                this.reconstructMethods();
                this.bindEvent();
                this.render();
        },
        setParameters : function(){
                this.$window = $(window);
                this.$container = $('#jsi-fountain-container');
                this.$canvas = $('
<canvas />');
                this.context = this.$canvas.appendTo(this.$container).get(0).getContext('2d');
                this.particles = [];
                this.fountains = [];
                this.resizeIds = [];
        },
        setup : function(){
                this.particles.length = 0;
                this.fountains.length = 0;
                this.resizeIds.length = 0;
                this.width = this.$container.width();
                this.height = this.$container.height();
                this.$canvas.attr({width : this.width, height : this.height});
                this.velocity = 1;
               
                while(true){
                        var distance = 0,
                                velocity = this.velocity;
                               
                        while(velocity >= 0){
                                velocity -= this.GRAVITY;
                                distance += velocity;
                        }
                        if.........完整代码请登录后点击上方下载按钮下载查看

网友评论0