首页 > 代码库 > canvas---fiveStar
canvas---fiveStar
使用了sonic (http://www.yyyweb.com/demo/inner-show/sonic-loading.html)
<!doctype html> <html> <meta charset="utf-8" /> <title>五星</title> <style> </style> <body> <div id="my" style="text-alifn:center;position:absolute;top:100px;left:100px;z-index:100;"></div> <script src="../src/sonic.js"></script> <script> var fiveStar = new Sonic({ width: 300, height: 300, fps: 30, strokeColor: ‘#FF7B24‘, stepsPerFrame: 2, trailLength: 1, pointDistance: .03, setup: function() { this._.lineWidth = 5; }, step: function(point, index, frame) { this._.beginPath(); for(var i=0;i<5;i++){ this._.lineTo(Math.cos((18+72*i - 0)/180*Math.PI) * 40 + 150 ,- Math.sin((18+72*i - 0 )/180*Math.PI) * 40 + 150); this._.lineTo(Math.cos((54+72*i - 0)/180*Math.PI) * 20 + 150 ,- Math.sin((54+72*i - 0 )/180*Math.PI) * 20 + 150); } this._.lineWidth = 10; this._.strokeStyle = "#FF2E82"; this._.fillStyle = "#333" this._.closePath(); this._.stroke(); }, path: [ [‘line‘, 161, 137.6, 150, 110, 130.9, 137.7] ] }); fiveStar.play(); document.body.appendChild(fiveStar.canvas); var circle = new Sonic({ width: 320, height: 320, padding: 5, strokeColor: ‘#FF2E82‘, pointDistance: .01, stepsPerFrame: 3, trailLength: .7, step: ‘fader‘, setup: function() { this._.lineWidth = 5; }, path: [ [‘arc‘, 50, 50, 50, 0, 360] ] }); circle.play(); document.getElementById("my").appendChild(circle.canvas); </script> </body> </html>
效果图:
canvas---fiveStar
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。