Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
Create particles
Reset
css
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: black; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; font-size: 14px; color: #fff; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; } canvas { position: fixed; width: 100%; height: 100%; } footer { position: fixed; right: 0; top: 0; right: 0; padding: 10px 10px; text-align: right; width: 240px; } a { display: inline-block; margin-left: 2px; padding: 2px 4px; color: rgba(52, 52, 54, 1); text-decoration: none; background-color: #fcd000; border-radius: 4px; opacity: 1; -webkit-transition: opacity 0.2s; transition: opacity 0.2s; } img { width: 300px; max-width: 30%; position: fixed; -webkit-transform: translate3d(0%, -50%, 0px); transform: translate3d(0%, -50%, 0px); top: 50%; left: 50%; pointer-events: none; } section { -webkit-transition: 0.4s ease; transition: 0.4s ease; opacity: 0; visibility: hidden; will-change: opacity, visibility; position: fixed; width: 100%; height: 100%; top: 0; left: 0; } button { -webkit-appearance: none; padding: 12px 24px; border-radius: 0; position: fixed; left: 50%; bottom: 24px; -webkit-transform: translateX(-50%); transform: translateX(-50%); text-transform: uppercase; letter-spacing: 2px; color: white; background: black; border: 1px solid white; cursor: none; } .output button { cursor: pointer; } button:focus, button:hover { color: black; background: white; } .input { cursor: none; opacity: 1; visibility: visible; }
JavaScript
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):n.starlings=r()}(this,function(){"use strict";return function(n,r,t,o,e,u,i,f){var a=f.onSetup;void 0===a&&(a=null);var v=f.onRepeat;void 0===v&&(v=null);var c=f.modifier;void 0===c&&(c=null);var l=f.perspective;void 0===l&&(l=1);var d=f.pixelRatio;void 0===d&&(d=1);var m=f.triangles;void 0===m&&(m=!1);var s,p,y=r.length,w=function(n,r){var t=s.createShader(n);return s.shaderSource(t,r),s.compileShader(t),t},b=function(){for(var n=0;n
1) { uniforms[0].value = 0; } uniforms[0].value += step; }; var options = { onSetup: onSetup, onRepeat: onRepeat, pixelRatio: pixelRatio }; starlings(canvas, geometry, multiplier, attributes, uniforms, vertexShader, fragmentShader, options); }; var getRandom = function getRandom(value) { return Math.random() * value - value / 2; }; var rotateY = function rotateY(matrix, angle) { var sin = Math.sin(angle); var cos = Math.cos(angle); var clone = JSON.parse(JSON.stringify(matrix)); matrix[0] = clone[0] * cos - clone[8] * sin; matrix[1] = clone[1] * cos - clone[9] * sin; matrix[2] = clone[2] * cos - clone[10] * sin; matrix[3] = clone[3] * cos - clone[11] * sin; matrix[8] = clone[0] * sin + clone[8] * cos; matrix[9] = clone[1] * sin + clone[9] * cos; matrix[10] = clone[2] * sin + clone[10] * cos; matrix[11] = clone[3] * sin + clone[11] * cos; }; var h2r = function h2r(p, q, t) { if (t < 0) t += 1; if (t > 1) t -= 1; if (t < 1 / 6) return p + (q - p) * 6 * t; if (t < 1 / 2) return q; if (t < 2 / 3) return p + (q - p) * 6 * (2 / 3 - t); return p; }; var getHSL = function getHSL(h, s, l) { h = (h % 1 + 1) % 1; s = Math.max(0, Math.min(1, s)); l = Math.max(0, Math.min(1, l)); if (s === 0) return [l, l, l]; var p = l <= 0.5 ? l * (1 + s) : l + s - l * s; var q = 2 * l - p; return [h2r(q, p, h + 1 / 3), h2r(q, p, h), h2r(q, p, h - 1 / 3)]; }; var ratio = window.innerWidth / window.innerHeight; var halfWidth = window.innerWidth * devicePixelRatio / 2; var halfHeight = window.innerHeight * devicePixelRatio / 2; document.querySelector('.create').addEventListener('click', function () { points.length = 0; segments.map(function (segment) { return segment.map(function (point) { for (var i = 0; i < 100; i += 1) { var x = ((point.x - halfWidth) / halfWidth * ratio).toFixed(4) * 1; var y = ((point.y - halfHeight) / halfHeight).toFixed(4) * -1; points.push({ x: x, y: y }); } }); }); input.style.opacity = '0'; input.style.visibility = 'hidden'; setTimeout(function () { output.style.opacity = '1'; output.style.visibility = 'visible'; initialize(); }, 600); }); document.querySelector('.reset').addEventListener('click', function () { input.querySelector('canvas').getContext('2d').clearRect(0, 0, window.innerWidth * window.devicePixelRatio, window.innerHeight * window.devicePixelRatio); output.style.opacity = '0'; output.style.visibility = 'hidden'; setTimeout(function () { segments.length = 0; points.length = 0; input.style.opacity = '1'; input.style.visibility = 'visible'; }, 600); }); })(); }
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>canvas画图加粒子动画-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号