Processing 特训(Oscilation) - 4

明确概念

弧度:弧长等于半径的弧为1,float angle = radians(N)

rectMode(CENTER):默认绘制长方形是以左上角为起始点,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:当需要修改坐标系系统时使用,The pushMatrix() function saves the current coordinate system to the stack and popMatrix() restores the prior coordinate system.

translate:修改坐标系圆点的位置,translate(x, y, z)

rotate:The coordinates are always rotated around their relative position to the origin(origin即坐标系的圆点), rotate(radians)

sin/cos: amplitude * sin/cos(angle),angle确定数值,amplitude确定数值在y坐标上的表现

beginShape()/endShape(): 用于绘制复杂图形的开始和结束,vertex(x, y)用于确定图形中的各个点

明确功能

1.多个长方形在空间中旋转

功能设计

类:Mover

属性:location,aVelocity,aAcceleration,size

方法:move(),display()

伪代码

setup(){

}

draw(){

    mover.move()

    mover.display()

}

class Mover{

    定义属性

    Mover(){}

    定义方法

}

正式代码

见:

Processing/Oscilation at master · JoeyQiang/Processing · GitHub

代码优化

1.沿着速度方向转

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 12,183评论 0 10
  • #1996 AHSME ##1996 AHSME Problems/Problem 1 The addition ...
    abigtreenj阅读 5,396评论 0 0
  • pyspark.sql模块 模块上下文 Spark SQL和DataFrames的重要类: pyspark.sql...
    mpro阅读 13,222评论 0 13
  • 我是个很懒的人,开发过程中经常有意无意地刻意避开数学相关的知识,你也知道解数学题非常枯燥无趣。平时写动画也尽量使用...
    grain先森阅读 5,403评论 3 3
  • 关于产品开发的十句废话: 1, 我们从不相信对一个群众还不知道的产品进行市场研究的做法,所以我们不做任何这类研究。...
    马唐阅读 3,738评论 0 3