茄子在线看片免费人成视频,午夜福利精品a在线观看,国产高清自产拍在线观看,久久综合久久狠狠综合

    <s id="ddbnn"></s>
  • <sub id="ddbnn"><ol id="ddbnn"></ol></sub>

  • <legend id="ddbnn"></legend><s id="ddbnn"></s>

    html5使用canvas繪制太陽系效果
    來源:易賢網(wǎng) 閱讀:1849 次 日期:2015-03-05 13:55:41
    溫馨提示:易賢網(wǎng)小編為您整理了“html5使用canvas繪制太陽系效果”,方便廣大網(wǎng)友查閱!

    星球變量名公轉(zhuǎn)周期光色暗色

    水星Mercury87.70#a69697#5c3e40

    金星Venus224.701.70#c4bbac#1f1315

    地球Earth365.2422#78b1e8#050c12

    火星Mars686.98#cec9b6#76422d

    木星Jupiter4332.589#c0a48e#322

    土星Saturn10759.95#f7f9e3#5c4553

    天王星Uranus30799.095#a7e115#19243a

    海王星Neptune60152.95#0661b2#1E3b73

    <canvas id="canvas" width="1000" height="1000" style="background-color: #000;"></canvas>

    代碼如下:

    var canvas=document.getElementById("canvas");

    var cxt=canvas.getContext("2d");

    function DrawTrack(){

    for(var i=0;i<8;i++){

    cxt.beginPath();

    cxt.arc(500,500,(i+1)*50,0,360,false);

    cxt.closePath();

    cxt.strokeStyle="#fff";

    cxt.stroke();

    }

    }

    function DrawStart(x,y,radius,cycle,sColor,eColor){

    //畫出星球需要哪些屬性

    //星球的坐標(biāo)點(diǎn)

    this.x=x;

    this.y=y;

    //星球的半徑

    this.radius=radius;

    //星球的顏色(開始色,結(jié)束色)

    this.sColor=sColor;

    this.eColor=eColor;

    //創(chuàng)建一個(gè)漸變色空對(duì)象

    this.color=null;

    this.time=0;

    //公共周期

    this.cycle=cycle;

    this.draw=function(){

    cxt.save();

    cxt.translate(500,500);

    //設(shè)置旋轉(zhuǎn)角度

    cxt.rotate(this.time*360/this.cycle*Math.PI/180);

    cxt.beginPath();

    cxt.arc(this.x,this.y,this.radius,0,360,false);

    cxt.closePath();

    this.color=cxt.createRadialGradient(this.x,this.y,0,this.x,this.y,this.radius);

    this.color.addColorStop(0,this.sColor);

    this.color.addColorStop(1,this.eColor);

    cxt.fillStyle=this.color;

    cxt.fill();

    cxt.restore();

    this.time+=1;

    }

    }</p> <p> function Sun(){//太陽1

    DrawStart.call(this,0,0,20,0,"#f00","#f90");

    }

    function Mercury(){//水星2

    DrawStart.call(this,0,-50,10,87.70,"#A69697","#5c3e40");

    }

    function Venus(){//金星3

    DrawStart.call(this,0,-100,10,224.71,"#c4bbac","#1f1315");

    }

    function Earth(){//地球4

    DrawStart.call(this,0,-150,10,365.224,"#78b1e8","#050c12");

    }

    function Mars(){//火星5

    DrawStart.call(this,0,-200,10,686.98,"#cec9b6","#76422d");

    }

    function Jupiter(){//木星6

    DrawStart.call(this,0,-250,10,4332.589,"#c0a48e","#322");

    }

    function Saturn(){//土星7

    DrawStart.call(this,0,-300,10,10759.5,"#f7f9e3","#5c4533");

    }

    function Uranus(){//天王星8

    DrawStart.call(this,0,-350,10,30799.95,"#a7e1e5","#19243a");

    }

    function Neptune(){//天王星9

    DrawStart.call(this,0,-400,10,60152.95,"#0661b2","#1E3b73");

    }

    var s=new Sun();//1

    var m=new Mercury();//2

    var v=new Venus();//3

    var e=new Earth();//4

    var ma=new Mars();//5

    var j=new Jupiter();//6

    var sa=new Saturn();//7

    var ur=new Uranus();//8

    var ne=new Neptune();//9

    setInterval(function(){

    cxt.clearRect(0,0,1000,1000);

    DrawTrack();

    s.draw();

    m.draw();

    v.draw();

    e.draw();

    ma.draw();

    j.draw();

    sa.draw();

    ur.draw();

    ne.draw();

    },10);

    名單

    更多信息請(qǐng)查看IT技術(shù)專欄

    更多信息請(qǐng)查看網(wǎng)頁制作
    易賢網(wǎng)手機(jī)網(wǎng)站地址:html5使用canvas繪制太陽系效果
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

    2026上岸·考公考編培訓(xùn)報(bào)班

    • 報(bào)班類型
    • 姓名
    • 手機(jī)號(hào)
    • 驗(yàn)證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn) | 投訴建議
    工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
    云南網(wǎng)警備案專用圖標(biāo)
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報(bào)警專用圖標(biāo)