Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
css
* { margin:0; padding:0; } canvas { display:block; }
JavaScript
function Circle (x, y, radius) { this.x = x; this.y = y; this.radius = radius; this.angle = 0; } function Star (x, y, rotation) { this.x = x; this.y = y; this.length = 15; this.scaleX = .1; this.scaleY = .1; this.rotation = rotation; this.angle = Math.random() * 360; this.vx = 0; this.vy = 0; this.alpha = 1; } Star.prototype.draw = function(ctx) { ctx.save(); ctx.globalAlpha = this.alpha; ctx.translate(this.x, this.y); ctx.rotate(this.rotation * Math.PI / 180); ctx.beginPath(); ctx.moveTo(0,0); ctx.lineTo(24,0); ctx.lineTo(24,24); ctx.lineTo(0,24); ctx.closePath(); ctx.scale(this.scaleX, this.scaleY); ctx.strokeStyle = 'rgba(0,0,0,0)'; ctx.lineCap = 'butt'; ctx.lineJoin = 'miter'; ctx.miterLimit = 4; ctx.save(); ctx.fillStyle = "#ffffff"; ctx.beginPath(); ctx.moveTo(12,0.89); ctx.lineTo(15.609,8.204); ctx.lineTo(23.682,9.377); ctx.lineTo(17.842,15.071); ctx.lineTo(19.22,23.11); ctx.lineTo(12,19.315); ctx.lineTo(4.78,23.11); ctx.lineTo(6.159,15.071); ctx.lineTo(0.318,9.377); ctx.lineTo(8.39,8.204); ctx.lineTo(12,0.89); ctx.closePath(); ctx.fill(); ctx.stroke(); ctx.restore(); ctx.restore(); }; function Square(x, y) { this.x = x; this.y = y; } var canvas = document.querySelector('canvas'), ctx = canvas.getContext('2d'), W = canvas.width = window.innerWidth, H = canvas.height = window.innerHeight, stars = [], circle = new Circle(W / 2, H / 2, 110), square = new Square(W / 2, H / 2); function animateRect(square) { var star, counter = 0; square.x = W / 2 + (circle.radius * Math.cos(circle.angle * .047)); square.y = H / 2 + (circle.radius * Math.sin(circle.angle * .047)); circle.angle++; stars.push(new Star(square.x, square.y, Math.random() * 360)); } function moveStars() { for (var i = 0; i < stars.length; i++) { var star = stars[i]; if (star.scaleX <= 1) { star.scaleX += .05; star.scaleY += .05; } if (star.alpha >= .05) { star.alpha -= .015; } else if (star.alpha < .1) { stars.splice(stars[i], 1); } star.vx = Math.sin(star.angle) * .5; star.vy = Math.cos(star.angle) * .5; star.angle += .1; star.x += star.vx; star.y += star.vy; star.draw(ctx); } } (function drawFrame(){ window.requestAnimationFrame(drawFrame, canvas); ctx.fillStyle = '#0f1476'; ctx.fillRect(0, 0, W, H); animateRect(square); moveStars(); }());
粒子
时间
文字
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号