rotate.pde
来自「This is processing for java examples.」· PDE 代码 · 共 39 行
PDE
39 行
/** * Rotate. * * Rotating a square around the Z axis. To get the results * you expect, send the rotate function angle parameters that are * values between 0 and PI*2 (TWO_PI which is roughly 6.28). If you prefer to * think about angles as degrees (0-360), you can use the radians() * method to convert your values. For example: scale(radians(90)) * is identical to the statement scale(PI/2). */ void setup(){ size(200,200); noStroke(); fill(255); frameRate(30);}float angle;float cosine;float jitter;void draw(){ background(102); if(second()%2 == 0){ jitter = (random(-0.1, 0.1)); } angle = angle + jitter; cosine = cos(angle); translate(width/2, height/2); rotate(cosine); rectMode(CENTER); rect(0, 0, 115, 115); }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?