THREE實戰5 canvans紋理

2021-10-04 20:31:44 字數 2247 閱讀 8840

canvans紋理

效果圖

**重構

js繪製時鐘

var canvas;

function

clock()

};function

line()

; line.prototype =

newcanvobject()

; line.prototype.fill =

false

; line.prototype.start =[0

,0];

line.prototype.end =[5

,5];

line.prototype.

draw

=function

(ctx)

;function

circle()

; circle.prototype =

newcanvobject()

; circle.prototype.

draw

=function

(ctx)

;var circle =

newcircle()

; circle.ctx = ctx;

circle.x =

100;

circle.y =

100;

circle.radius =90;

circle.fill =

true

; circle.borderwidth =6;

circle.fillcolor =

'#ffffff'

;var hour =

newline()

; hour.ctx = ctx;

hour.x =

100;

hour.y =

100;

hour.bordercolor =

"#000000"

; hour.borderwidth =10;

hour.rotation =0;

hour.start =[0

,20];

hour.end =[0

,-50]

;var minute =

newline()

; minute.ctx = ctx;

minute.x =

100;

minute.y =

100;

minute.bordercolor =

"#333333"

; minute.borderwidth =7;

minute.rotation =0;

minute.start =[0

,20];

minute.end =[0

,-70]

;var seconds =

newline()

; seconds.ctx = ctx;

seconds.x =

100;

seconds.y =

100;

seconds.bordercolor =

"#ff0000"

; seconds.borderwidth =4;

seconds.rotation =0;

seconds.start =[0

,20];

seconds.end =[0

,-80]

;var center =

newcircle()

; center.ctx = ctx;

center.x =

100;

center.y =

100;

center.radius =5;

center.fill =

true

; center.bordercolor =

'orange'

;for

(var i=

0,ls=

,cache;i<

12;i++

) timerid =

setinterval

(function()

,(1000

/framerate)|0

);}else

}

threejs重構

THREE實戰3 理解光源

光的三原色 紅red 綠green 藍blue。色彩模式 hsl hsv。色相hue 飽和度saturation 亮度lightness 明度 value。白色反射所有光 白色的物體利於測試燈光 1.環境光 把顏色新增到整個場景和物件的當前顏色上 maya環境光測試 乙個藍色的環境光渲染灰色box ...

部落格專案實戰5

新增字段驗證 引入 joi 模組 const joi require joi module.exports async req,res required error new error 密碼格式不符合要求.role joi.string valid normal admin required err...

《Java併發程式設計實戰》 5

每當看到new thread runnable start 時,並且你希望獲得一種更靈活的執行策略時,請考慮使用excecutor來代替thread。completionservice將execute和blockingqueue的功能融合在一起。executorcompletionservice實現...