HTML5中怎么实现缓冲效果

这篇文章将为大家详细讲解有关HTML 5中怎么实现缓冲效果,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

成都创新互联公司专注于企业网络营销推广、网站重做改版、栾川网站定制设计、自适应品牌网站建设、HTML5建站商城网站建设、集团公司官网建设、成都外贸网站建设公司、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为栾川等各大城市提供网站开发制作服务。

这里是案例的演示代码:

                    loading             function loading(canvas,options){         this.canvas = canvas;         if(options){           this.radius = options.radius||12;           this.circleLineWidth = options.circleLineWidth||4;           this.circleColor = options.circleColor||'lightgray';           this.dotColor = options.dotColor||'gray';         }else{           this.radius = 12;           this.circelLineWidth = 4;           this.circleColor = 'lightgray';           this.dotColor = 'gray';         }       }       loading.prototype = {         show:function (){           var canvas = this.canvas;           if(!canvas.getContext)return;           if(canvas.__loading)return;           canvas.__loading = this;           var ctx = canvas.getContext('2d');           var radius = this.radius;           var rotators = [{angle:0,radius:1.5},{angle:3/radius,radius:2},{angle:7/radius,radius:2.5},{angle:12/radius,radius:3}];           var me = this;           canvas.loadingInterval = setInterval(function(){             ctx.clearRect(0,0,canvas.width,canvas.height);             var lineWidth = me.circleLineWidth;             var center = {x:canvas.width/2 - radius,y:canvas.height/2-radius};             ctx.beginPath();             ctx.lineWidth = lineWidth;             ctx.strokeStyle = me.circleColor;             ctx.arc(center.x,center.y,radius,0,Math.PI*2);             ctx.closePath();             ctx.stroke();             for(var i=0;i                        

                        

               

第二个较为简单,在一个圆环上有一个相同圆心相同半径的圆弧在不停的转动。画图的步骤是首先画一个圆环,然后画一个不同颜色相同圆心半径的圆弧,在每次刷新画布时改变圆弧的起始角度。

这里是案例的演示代码:

                loading                      您的浏览器不支持html5哟       

                     

               

关于HTML 5中怎么实现缓冲效果就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。


当前题目:HTML5中怎么实现缓冲效果
链接分享:http://ybzwz.com/article/ppciss.html