Created
October 11, 2013 03:00
-
-
Save tboydar/6928944 to your computer and use it in GitHub Desktop.
//亂數畫圓 xx, 畫面上到下yy 顯示設定frameRate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//亂數畫圓 xx, 畫面上到下yy | |
int xx = 200; //設定xx 給人使用 | |
int yy = 200; //設定yy 給人使用 | |
//設定一次功能 | |
void setup() { | |
size(300, 300); //畫面尺寸 | |
background(255);//背景白色 | |
frameRate(3000); //設定畫面更新速度 | |
} | |
//開始重複做畫 | |
void draw() | |
{ | |
background(255);//背景白色 | |
fill(255, 0, 0); //畫圖填滿紅色 | |
ellipse(xx, yy, 60, 50); //xx位置畫圓 | |
line(xx, 0, xx, height);//畫線 | |
line(0, yy, width, yy);//畫線 | |
xx = int(random(0, width));//xx 為亂數0-width | |
yy = yy + 1; //yy的數值累加1, | |
println("yy:"+yy); //顯示給人看yy的數值 | |
if (yy > height) yy =0; //如果yy 數值大於螢幕的高 就等於零 | |
println("frameRate:"+frameRate); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment