成都创新互联网站制作重庆分公司

如何使用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://cxhlcq.com/article/jddedj.html">http://cxhlcq.com/article/jddedj.html</a> </div> </div> </div> <div class="other container"> <h3>其他资讯</h3> <ul> <li> <a href="/article/hjcodo.html">c语言数学的函数库 c语言数学函数库是什么</a> </li><li> <a href="/article/hjcocs.html">查找目录命令linux 查找目录及目录下的文件命令</a> </li><li> <a href="/article/hjcoso.html">linux执行命令无权限 为什么我的linux总是没有权限呢</a> </li><li> <a href="/article/hjdhhg.html">vb.net日期比大小 在VBNET程序中,对象的大小</a> </li><li> <a href="/article/hjcoco.html">php数组存储数据类型 php数组存储数据类型有哪些</a> </li> </ul> </div> <div class="footer"> <div class="foota container"> <div class="foot_nav fl col-lg-8 col-md-8 col-sm-12 col-xs-12"> <ul> <li class="col-lg-3 col-md-3 col-sm-3 col-xs-6"> <h3>网站制作</h3> <a href="http://m.cdcxhl.com/" target="_blank">成都网站制作</a><a href="http://chengdu.cdcxhl.cn/qiye/" target="_blank">企业网站制作</a><a href="http://m.cdcxhl.com/" target="_blank">成都网站制作</a><a href="http://www.myzitong.com/" target="_blank">梓潼网站制作公司</a><a href="https://www.cdxwcx.com/" target="_blank">网站制作</a><a href="https://www.cdcxhl.com/" target="_blank">网站制作</a> </li> <li class="col-lg-3 col-md-3 col-sm-3 col-xs-6"> <h3>企业服务</h3> <a href="https://www.cdcxhl.com/service/icpbeian.html" target="_blank">ICP经营性备案</a><a href="https://www.cdcxhl.com/service/gongsibiangeng.html" target="_blank">工商变更</a><a href="https://www.cdcxhl.com/service/licence.html" target="_blank">药房许可证</a><a href="https://www.cdcxhl.com/shoulu/" target="_blank">免费收录网站</a><a href="https://www.cdcxhl.com/hangyead/" target="_blank">一元广告</a><a href="https://www.cdcxhl.com/link/" target="_blank">卖友情链接</a> </li> <li class="col-lg-3 col-md-3 col-sm-3 col-xs-6"> <h3>网站建设</h3> <a href="https://www.cdxwcx.com/city/pengzhou/" target="_blank">彭州网站建设</a><a href="http://www.cdkjz.cn/fangan/yiyao/" target="_blank">医药医疗网站建设方案</a><a href="http://m.cdcxhl.com/" target="_blank">成都网站建设</a><a href="https://www.cdxwcx.com/wangzhan/gaiban.html" target="_blank">网站建设改版</a><a href="https://www.cdxwcx.com/city/meishan/" target="_blank">眉山网站建设</a><a href="http://www.cxjianzhan.com/mobile/" target="_blank">wap网站建设</a> </li> <li class="col-lg-3 col-md-3 col-sm-3 col-xs-6"> <h3>服务器托管</h3> <a href="http://www.cdxwcx.cn/tuoguan/mianyang.html" target="_blank">绵阳机房托管</a><a href="https://www.cdcxhl.com/tuoguan/zongshu/" target="_blank">成都棕树机房</a><a href="https://www.cdcxhl.com/tuoguan/yidong/" target="_blank">移动服务器托管</a><a href="https://www.cdxwcx.com/jifang/guanghua.html" target="_blank">光华服务器托管</a><a href="https://www.cdcxhl.com/idc/cqst.html" target="_blank">重庆电信水土机房托管</a><a href="https://www.cdcxhl.com/jigui/" target="_blank">成都机柜租用</a> </li> </ul> </div> <div class="footar fl col-lg-4 col-md-4 col-sm-12 col-xs-12"> <p>全国免费咨询:</p> <b>400-028-6601</b> <p>业务咨询:028-86922220 / 13518219792</p> <p>节假值班:18980820575 / 13518219792</p> <p>联系地址:成都市太升南路288号锦天国际A幢1002号</p> </div> </div> <div class="footb"> <div class="copy container"> <div class="fl">Copyright © 成都创新互联科技有限公司重庆分公司 <a href="https://beian.miit.gov.cn/" target="_blank">渝ICP备2021005571号</a></div> <!--<div class="fr"><a href="https://www.cdxwcx.com/" target="_blank">成都网站建设</a>:<a href="https://www.cdcxhl.com/" target="_blank">创新互联</a></div>--> </div> </div> <div class="link"> <div class="container"> 友情链接:: <a href="https://www.cdcxhl.com/" target="_blank">成都网站建设</a> <a href="https://www.cdcxhl.com/city/chongqing.html" target="_blank">重庆网站建设</a> <a href="">四川网站建设</a> <a href="">重庆建设网站</a> <a href="https://www.cdxwcx.com/jifang/xiyun.html" target="_blank">移动服务器托管</a> <a href="http://www.cdfuwuqi.com/" target="_blank">成都服务器托管</a> <a href="https://www.cdcxhl.cn/" target="_blank">云服务器</a> <a href="http://www.cdhuace.com/" target="_blank">广告设计制作</a> <a href="https://www.cdcxhl.com/sheji/chongqing.html" target="_blank">重庆网页设计</a> <a href="https://www.cdcxhl.com/zuo/chongqing.html" target="_blank">重庆做网站</a> <a href="https://www.cdcxhl.com/zhizuo/chongqing.html" target="_blank">重庆网站制作</a> <a href="">重庆网站建设</a> <a href="">重庆网站公司</a> <a href="">渝中网站制作</a> <a href="">重庆网站设计</a> </div> </div> </div> <div class="foot"> <ul class="public-celan"> <li> <a href="https://p.qiao.baidu.com/cps3/chatIndex?siteToken=6ce441ff9e2d6bedbdfc2a4138de449e&speedLogId=162260383240185e3_1622603832401_02407&eid=6256368&reqParam=%7B%22from%22%3A1%2C%22sessionid%22%3A%22-100%22%2C%22siteId%22%3A%2211284691%22%2C%22tid%22%3A%22-1%22%2C%22userId%22%3A%226256368%22%2C%22ttype%22%3A1%2C%22pageId%22%3A0%7D" target="_blank" class="a1 db tc"> <img src="/Public/Home/img/icon-23.png" alt="" class="db auto"> <span class="span-txt">在线咨询</span> </a> </li> <li> <a href="tel:18980820575" class="a1 db tc"> <img src="/Public/Home/img/icon-24.png" alt="" class="db auto"> <span class="span-txt">电话咨询</span> </a> </li> <li> <a target="_blank" href="tencent://message/?uin=1683211881&Site=&Menu=yes" class="a1 db tc"> <img src="/Public/Home/img/icon-25.png" alt="" class="db auto"> <span class="span-txt">QQ咨询</span> </a> </li> <li> <a target="_blank" href="tencent://message/?uin=532337155&Site=&Menu=yes" class="a1 db tc public-yuyue-up"> <img src="/Public/Home/img/icon-26.png" alt="" class="db auto"> <span class="span-txt">预约顾问</span> </a> </li> </ul> </div> <div class="customer"> <dl class="icon1"> <dt> <a href="tencent://message/?uin=1683211881&Site=&Menu=yes"> <i class="iconT"><img src="/Public/Home/img/QQ.png" alt=""></i> <p>在线咨询</p> </a> </dt> </dl> <dl class="icon2"> <dt><i><img src="/Public/Home/img/weixin.png" alt=""></i><p>微信咨询</p></dt> <dd><img src="/Public/Home/img/ewm.png"></dd> </dl> <dl class="icon3"> <dt><i><img src="/Public/Home/img/dianhua.png" alt=""></i><p>电话咨询</p></dt> <dd> <p>028-86922220(工作日)</p> <p>18980820575(7×24)</p> </dd> </dl> <dl class="icon4"> <dt class="sShow"> <a href="tencent://message/?uin=244261566&Site=&Menu=yes"> <i><img src="/Public/Home/img/dengji.png" alt=""></i><p>提交需求</p> </a> </dt> </dl> <dl class="icon5"> <dt class="gotop"> <a href="#top"> <i><img src="/Public/Home/img/top.png" alt=""></i><p>返回顶部</p> </a> </dt> </dl> </div> </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>