P5基礎教學 4/4

2525

旋轉畫布rotate()

相對於現在的畫布角度,轉移 r 度 rotate(r) ,需要注意這邊的角度是弧度,不是角度喔!如果要使用角度,可以先用 angleMode(DEGREES) 角度,或是 angleMode(RADIANS) 弧度,來設定單位。

結合 rotate()、translate() 與 frameCount 創造不同的效果

先 translate(),再 rotate()

function draw() { translate(width/2,height/2) translate(frameCount,0) rotate(frameCount) rect(0,0,50,50)}

先 rotate(),再 translate()

function draw() { translate(width/2,height/2) rotate(frameCount) translate(frameCount,0) rect(0,0,50,50)}

No items found.
No items found.

Up next

Heading

This is some text inside of a div block.

2525 p5.js Basics 4/4

-

Up next

Heading

This is some text inside of a div block.

Series episodes

Oh no! No series episodes were found.