Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
css
html, body{ overflow: hidden; background: #000; margin: 0px; padding: 0px; } #canvas{ overflow: hidden; } #canvas:hover{ cursor: none; } #fps{ position: absolute; left: 5px; top: 0px; color: #fff; font-size: 20px; }
JavaScript
var c = document.getElementById("canvas"); var ctx = canvas.getContext("2d"); ctx.canvas.width = window.innerWidth; ctx.canvas.height = window.innerHeight; window.onresize = function () { ctx.canvas.width = window.innerWidth; ctx.canvas.height = window.innerHeight; } dots = []; emitRate = 9; minRad = 1; maxRad = 5; color = ""; opc = 0.6; sha = 0; lifeTime = 30; tn = 0; roc = 1; var controls = new function() { this.emitRate = emitRate; this.radiusMin = minRad; this.radiusMax = maxRad; this.color = "#ffffff"; this.opacity = opc; this.glow = sha; this.onChange_redraw = false; this.randomColor = true; this.lifeTime = lifeTime; this.circleShape = true; this.redraw = function() { emitRate = controls.emitRate; minRad = controls.radiusMin; maxRad = controls.radiusMax; lifeTime = controls.lifeTime; color = controls.color; opc = controls.opacity; sha = controls.glow; if (controls.onChange_redraw) { dots.splice(0, dots.length); } if (controls.circleShape) { roc = 1; } else { roc = 0; } if(controls.randomColor){ color = ""; } } } var gui = new dat.GUI({resizable : false}); gui.add(controls, "emitRate", 2, 100).step(1).onChange(controls.redraw); gui.add(controls, "lifeTime", 10, 300).onChange(controls.redraw); gui.add(controls, "radiusMin", 1, 10).step(1).onChange(controls.redraw); gui.add(controls, "radiusMax", 1, 30).step(1).onChange(controls.redraw); gui.add(controls, "opacity", 0.1, 1).onChange(controls.redraw); gui.add(controls, "glow", 0, 30).step(1).onChange(controls.redraw); gui.addColor(controls, "color").onChange(controls.redraw); gui.add(controls, "circleShape").onChange(controls.redraw); gui.add(controls, "randomColor").onChange(controls.redraw); gui.add(controls, "onChange_redraw").onChange(controls.redraw); prevx = ctx.canvas.width/2 -250; prevy = ctx.canvas.height/8; var prev2 = setInterval(preview, 16.67); increase = Math.PI * 2 / 40; counter = 0; function preview(){ prevx += 8; prevy += (Math.sin( counter ) / 2 + 0.5)*8; emitDots(prevx, prevy); counter += increase; } preview(); setTimeout(function(){clearInterval(prev2)}, 1000); function emitDots(mx, my){ for(i=0; i
1){ dots.splice(0, Math.ceil(dots.length/lifeTime)); } } function getFPS(){ tl = tn; tn = Date.now(); td = tn - tl; fps = Math.round(1000/td); fps >= 58 ? fps = 60 : fps; fpse = document.getElementById("fps"); fpse.innerHTML = "FPS: "+fps; fpse.style="color:hsl("+(fps*2)+",100%,50%)"; } function loop(){ ctx.clearRect(0,0,ctx.canvas.width,ctx.canvas.height); document.onmousemove = function(e){ mx = e.clientX; my = e.clientY; emitDots(mx, my); } document.ontouchmove = function(e){ mx = e.changedTouches[0].pageX; my = e.changedTouches[0].pageY; emitDots(mx, my); } animDots(); cleanUp(); getFPS(); } loop(); setInterval(loop, 16.67);
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>粒子发射器-jq22.com</title> <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script> <style>
</style> </head> <body>
<script>
</script>
</body> </html>
2012-2021 jQuery插件库版权所有
jquery插件
|
jq22工具库
|
网页技术
|
广告合作
|
在线反馈
|
版权声明
沪ICP备13043785号-1
浙公网安备 33041102000314号