网站建设资讯

NEWS

网站建设资讯

如何使用html5制作loading图

小编给大家分享一下如何使用html5制作loading图,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

网站建设哪家好,找创新互联建站!专注于网页设计、网站建设、微信开发、重庆小程序开发、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了乌兰免费建站欢迎大家使用!

代码如下:

<!DOCTYPE html>

</ title></p><p></ head></p><p><body></p><p><canvas id =“ canvas”> </ canvas> </ p> <p> <script></p><p>var Loading =功能(画布,选项){</p><p>this.canvas = document.getElementById(canvas);</p><p>this.options =选项;</p><p>}; </ p> <p> Loading.prototype = {</p><p>构造函数:正在加载,</p><p>显示:function(){</p><p>var canvas = this.canvas,</p><p>begin = this.options.begin,</p><p>old = this.options.old,</p><p>lineWidth = this .options.lineWidth,</p><p>canvasCenter = {x:canvas.width / 2,y:canvas.height / 2},</p><p>ctx = canvas.getContext(“ 2d”),</p><p>color = this.options.color,</p><p>num = this.options.num,</p><p>angle = 0 ,</p><p>lineCap = this.options.lineCap,</p><p>CONST_PI = Math.PI *(360 / num)/ 180;</p><p>window.timer = setInterval(function(){</p><p>ctx.clearRect(0,0,canvas.width,canvas.height);</p><p>for(var i = 0; i <num; i + = 1){</p><p>ctx.beginPath();</p><p>ctx.strokeStyle = color [num-1-i];</p><p>ctx.lineWidth = lineWidth;</p><p>ctx.lineCap = lineCap;</p><p>ctx.moveTo(canvasCenter.x + Math.cos(CONST_PI * i +角度)*开始,canvasCenter.y + Math.sin(CONST_PI * i +角度)*开始);</p><p>ctx.lineTo(canvasCenter.x + Math.cos(CONST_PI * i + angle)*旧,canvasCenter.y + Math.sin(CONST_PI * i + angle)* old);</p><p>ctx.stroke();</p><p>ctx.closePath();</p><p>}</p><p>angle + = CONST_PI;</p><p>console.log(angle)</p><p>},50);</p><p>},</p><p>hide:function(){</p><p>clearInterval(window.timer);</p><p>}</p><p>}; </ p> <p>(函数(){</p><p>var options = {</p><p>num:8,</p><p>begin:20,</p><p>old:40,</p><p>lineWidth:10,</p><p>lineCap:“ round”,</p><p>颜色:[“ rgb(0,0,0)”,“ rgb(20,20,20 )” ,“ rgb(40、40、40)”,“ rgb(60、60、60)”,“ rgb(80、80、80)”,“ rgb(100、100、100)”,“ rgb(120, 120,120)“,” rgb(140,140,140)“]</p><p>};</p><p>var loading = new Loading(“ canvas”,options);</p><p>loading.show();</p><p>}());</p><p></ script></p><p></ body></p><p></ html></p><p>以上是“如何使用html5制作loading图”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!</p> <br> 网页标题:如何使用html5制作loading图 <br> 文章路径:<a href="http://njwzjz.com/article/jddedj.html">http://njwzjz.com/article/jddedj.html</a> </div> </div> <div class="other"> <h3>其他资讯</h3> <ul> <li> <a href="/article/ieiogp.html">Python中字典比列表快的原因是什么</a> </li><li> <a href="/article/ieiohe.html">layui如何实现form表单同时提交数据和文件</a> </li><li> <a href="/article/ieioji.html">Ciscodk:CIW认证的好处</a> </li><li> <a href="/article/ieioho.html">机器学习常用于什么领域</a> </li><li> <a href="/article/ieidds.html">作为一个软件开发公司如何让自己的技术落地应用产生价值呢?</a> </li> </ul> </div> </div> </div> <footer> <div class="footop"> <div class="wrap"> <div class="bottomrpw"> <div class="erp arp"> <dl> <dt>ADDRESS</dt> <dd class="address"> <i class="icon"></i> <span class="word">成都市青羊区锦天国际1号楼1002室</span> </dd> </dl> </div> <div class="erp arp"> <dl> <dt>TEL</dt> <dd class="phonum"> <i class="icon"></i> <span class="word en"> <a href="tel:18980820575">18980820575</a> </span> </dd> </dl> </div> <div class="erp crp"> <dl> <dt>OTHER</dt> <dd> <a class="word get-quote">获得报价与方案</a> </dd> <dd> <a href="#" target="_blank" rel='nofollow' class="word" title="付款方式">付款方式</a> </dd> </dl> </div> <div class="erp code-rp"> <dl> <dt>Wechat</dt> <dd class="code-wrap"> <span class="code"> <img src="/Public/Home/images/qr-code.jpg" alt="微信公众号" /> </span> </dd> </dl> </div> </div> </div> </div> <div class="footerbot"> <div class="friendlinks"> <div class="wrap"> <ul class="rpl"> <li><a href="https://www.cdxwcx.com/" target="_blank">网站建设</a></li> <li><a href="https://www.cdcxhl.com/" target="_blank">网站制作</a></li> <li><a href="http://www.cdxwcx.cn" target="_blank">做网站</a></li> <li><a href="https://www.cdcxhl.com/" target="_blank">成都网站设计</a></li> <li><a href="http://chengdu.cdcxhl.com/" target="_blank">营销网站建设</a></li> <li><a href="http://www.cdcxhl.cn" target="_blank">域名注册</a></li> <li><a href="https://www.xwcx.net/" target="_blank">服务器托管</a></li> <li><a href="https://www.scvps.cn" target="_blank">虚拟主机</a></li> <li><a href="https://www.scvps.cn" target="_blank">域名注册</a></li> <li><a href="http://www.cdhuace.com" target="_blank">成都广告设计</a></li> <li><a href="http://www.dmvi.cn" target="_blank">成都广告公司</a></li> <li><a href="http://www.cdfuwuqi.com/" target="_blank">服务器托管</a></li> <li><a href="https://www.cdxwcx.com/" target="_blank">成都网站建设</a></li> <li><a href="http://www.cdkjz.cn/" target="_blank">成都网站建设</a></li> <li><a href="http://www.kswcd.com/" target="_blank">成都网站设计</a></li> </ul> </div> </div> <div class="wrap"> <div class="copyright"> <span class="en">©2024</span> 四川内江网站建设公司 <span class="en">ALL RIGHTS RESERVED.</span> <a rel="nofollow" href="http://beian.miit.gov.cn/" target="_blank">蜀ICP备2024060514号</a> </div> </div> </div> </footer> <div class="fcwrap"> <ul class="rpl clearfix"> <li class="phone"> <a rel="nofollow" target="_blank" href="tel:18980820575"> <i class="icon"></i> <strong>18980820575</strong> </a> </li> <li class="qq"> <a rel="nofollow" target="_blank" href="https://wpa.qq.com/msgrd?v=1&uin=244261566&site=qq&menu=yes"> <i class="icon"></i> <strong>244261566</strong> </a> </li> <li class="back-top"> <a href="javascript:void(0)" rel="nofollow" class="back-to-top"> <i class="icon"></i> <strong>回到顶部</strong> </a> </li> </ul> </div> <!--nav--> <div class="n-Wrap"> <div class="navBar visble show"> <div class="barlogo"> <a href="/" rel="nofollow"> <img src="/Public/Home/images/logo1.png" alt="成都做网站" /> <img src="/Public/Home/images/logo2.png" alt="成都网站设计" /> </a> </div> <div class="bmenu"> <i class="bar-top"><span></span></i> <i class="bar-cen"><span></span></i> <i class="bar-bom"><span></span></i> <i class="bar-left"><span></span></i> <i class="bar-right"><span></span></i> </div> </div> <section class="fixmenu"> <div class="close-bar"> <i class="bar-left"><span></span></i> <i class="bar-right"><span></span></i> </div> <nav class="smph"> <ul> <li class="index-hrefs on"><a href="http://www.njwzjz.com/"><font>首页</font></a></li> <li><a href="/about/" rel="nofollow"><font>关于我们</font></a></li> <li><a href="/service/" rel="nofollow"><font>服务范围</font></a></li> <li><a href="/case/" rel="nofollow"><font>案例展示</font></a></li> <li><a href="/solve/" rel="nofollow"><font>解决方案</font></a></li> <li><a href="/news/" rel="nofollow"><font>建站资讯</font></a></li> <li><a href="/contact/" rel="nofollow"><font>联系我们</font></a></li> </ul> <div class="pwrap"> <span class="label">服务热线</span> <strong class="phone"><a href="tel:18980820575">18980820575</a></strong> </div> </nav> </section> </div> <!--end nav--> <script src="/Public/Home/js/hotcss.js"></script> <script type="text/javascript" src="/Public/Home/js/su_new.js"></script> </body> </html> <script> $(".con img").each(function(){ var src = $(this).attr("src"); //获取图片地址 var str=new RegExp("http"); var result=str.test(src); if(result==false){ var url = "https://www.cdcxhl.com"+src; //绝对路径 $(this).attr("src",url); } }); window.onload=function(){ document.oncontextmenu=function(){ return false; } } </script>