【processing】小代码4

时间:2024-01-17 11:29:02

translate(x,y);  移动坐标原点到x,y处

rotate(angle); 坐标沿原点顺时针转动angle度

scale(n); 绘制图像放大n倍

pushMatrix() 将当前坐标压入栈

popMatrix() 将坐标弹栈

--------------------------------------

windows系统下 用P3D一直报错,检查的时候还把之前写好的东西给弄没了  郁闷 换linux 终于可以显示了 但是smooth()不能用,说我硬件不支持。 而且linux下写的代码拷不出来,贴个图,凑合吧。

【processing】小代码4【processing】小代码4

两个方形沿不同的坐标转。

-------------------------------------------------------------------------------------

millis():毫秒

second() 秒

minute() 分

hour() 小时

void setup()
{
size(,);
}
void draw()
{
background();
int ms = millis();
int s = second();
int m = minute();
int h = hour();
fill(,,,);
rect(ms/,,,);
fill(,,,);
rect(s*,,,);
fill(,,,);
rect(m,,,);
fill(,,,);
rect(h,,,);
}

四个小矩形会根据时间运动

------------------------------------------------------

定义函数:跟C语言一样

-----------------------------------------------------

定义类:

class NAME
{
  变量;
  NAME(.......){.....} //构造函数
  功能函数1;
  功能函数2;
  ...
}
----------------------------------------------------------------

数组:跟C++差不多

int [] number = new int[6];