Processing 特訓(xùn)(Oscilation) - 4

明確概念

弧度:弧長(zhǎng)等于半徑的弧為1,float angle = radians(N)

rectMode(CENTER):默認(rèn)繪制長(zhǎng)方形是以左上角為起始點(diǎn),rectMode(CENTER) interprets the first two parameters of rect() as the shape's center point, while the third and fourth parameters are its width and height.

pushMatrix/popMatrix:當(dāng)需要修改坐標(biāo)系系統(tǒng)時(shí)使用,The pushMatrix() function saves the current coordinate system to the stack and popMatrix() restores the prior coordinate system.

translate:修改坐標(biāo)系圓點(diǎn)的位置,translate(x, y, z)

rotate:The coordinates are always rotated around their relative position to the origin(origin即坐標(biāo)系的圓點(diǎn)), rotate(radians)

sin/cos: amplitude * sin/cos(angle),angle確定數(shù)值,amplitude確定數(shù)值在y坐標(biāo)上的表現(xiàn)

beginShape()/endShape(): 用于繪制復(fù)雜圖形的開(kāi)始和結(jié)束,vertex(x, y)用于確定圖形中的各個(gè)點(diǎn)

明確功能

1.多個(gè)長(zhǎng)方形在空間中旋轉(zhuǎn)

功能設(shè)計(jì)

類:Mover

屬性:location,aVelocity,aAcceleration,size

方法:move(),display()

偽代碼

setup(){

}

draw(){

? ? mover.move()

? ? mover.display()

}

class Mover{

? ? 定義屬性

? ? Mover(){}

????定義方法

}

正式代碼

見(jiàn):

Processing/Oscilation at master · JoeyQiang/Processing · GitHub

代碼優(yōu)化

1.沿著速度方向轉(zhuǎn)

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,872評(píng)論 0 10
  • #1996 AHSME ##1996 AHSME Problems/Problem 1 The addition ...
    abigtreenj閱讀 1,611評(píng)論 0 0
  • pyspark.sql模塊 模塊上下文 Spark SQL和DataFrames的重要類: pyspark.sql...
    mpro閱讀 9,932評(píng)論 0 13
  • 我是個(gè)很懶的人,開(kāi)發(fā)過(guò)程中經(jīng)常有意無(wú)意地刻意避開(kāi)數(shù)學(xué)相關(guān)的知識(shí),你也知道解數(shù)學(xué)題非??菰餆o(wú)趣。平時(shí)寫(xiě)動(dòng)畫(huà)也盡量使用...
    grain先森閱讀 1,600評(píng)論 3 3
  • 關(guān)于產(chǎn)品開(kāi)發(fā)的十句廢話: 1, 我們從不相信對(duì)一個(gè)群眾還不知道的產(chǎn)品進(jìn)行市場(chǎng)研究的做法,所以我們不做任何這類研究。...
    馬唐閱讀 683評(píng)論 0 3

友情鏈接更多精彩內(nèi)容