婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > 使用html5制作loading圖的示例

使用html5制作loading圖的示例

熱門標簽:地圖標注柱狀圖 怎么做百度地圖標注 智能芯電話機器人 臨海地圖標注app 小朱地圖標注 咸陽穩定外呼系統軟件 百度地圖標注為什么總是封號 四川移動電銷外呼客戶管理系統 400開頭的電話好申請不


復制代碼
代碼如下:

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<canvas id = "canvas"></canvas></p> <p> <script>
var Loading = function (canvas, options) {
this.canvas = document.getElementById(canvas);
this.options = options;
};</p> <p> Loading.prototype = {
constructor: Loading,
show: function () {
var canvas = this.canvas,
begin = this.options.begin,
old = this.options.old,
lineWidth = this.options.lineWidth,
canvasCenter = {x: canvas.width / 2, y: canvas.height / 2},
ctx = canvas.getContext("2d"),
color = this.options.color,
num = this.options.num,
angle = 0,
lineCap = this.options.lineCap,
CONST_PI = Math.PI * (360 / num) / 180;
window.timer = setInterval(function () {
ctx.clearRect(0, 0, canvas.width, canvas.height);
for (var i = 0; i < num; i += 1) {
ctx.beginPath();
ctx.strokeStyle = color[num - 1 - i];
ctx.lineWidth = lineWidth;
ctx.lineCap= lineCap;
ctx.moveTo(canvasCenter.x + Math.cos(CONST_PI * i + angle) * begin, canvasCenter.y + Math.sin(CONST_PI * i + angle) * begin);
ctx.lineTo(canvasCenter.x + Math.cos(CONST_PI * i + angle) * old, canvasCenter.y + Math.sin(CONST_PI * i + angle) * old);
ctx.stroke();
ctx.closePath();
}
angle += CONST_PI;
console.log(angle)
},50);
},
hide: function () {
clearInterval(window.timer);
}
};</p> <p> (function () {
var options = {
num : 8,
begin: 20,
old: 40,
lineWidth: 10,
lineCap: "round",
color: ["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)"]
};
var loading = new Loading("canvas", options);
loading.show();
}());
</script>
</body>
</html>


效果圖:

標簽:陜西 平頂山 山南 黃石 南平 公主嶺 黃石 平涼

巨人網絡通訊聲明:本文標題《使用html5制作loading圖的示例》,本文關鍵詞  使用,html5,制作,loading,圖,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《使用html5制作loading圖的示例》相關的同類信息!
  • 本頁收集關于使用html5制作loading圖的示例的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 鄂伦春自治旗| 满洲里市| 彭泽县| 常州市| 安化县| 巴林左旗| 民丰县| 汨罗市| 南召县| 山西省| 汪清县| 湖北省| 景洪市| 尼木县| 汉寿县| 玉树县| 华宁县| 亚东县| 郑州市| 西丰县| 黄石市| 从化市| 孝义市| 祁连县| 洪江市| 刚察县| 和政县| 井冈山市| 南充市| 乡城县| 宜川县| 广灵县| 塘沽区| 漠河县| 乌海市| 夏邑县| 灵宝市| 高清| 拜泉县| 盐池县| 山阴县|