Created
October 11, 2013 02:56
-
-
Save tboydar/6928903 to your computer and use it in GitHub Desktop.
//亂數畫圓 xx, 畫面上到下yy
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
//亂數畫圓 | |
int xx = 200; //設定xx 給人使用 | |
int yy = 200; //設定yy 給人使用 | |
//設定一次功能 | |
void setup() { | |
size(300, 300); //畫面尺寸 | |
background(255);//背景白色 | |
} | |
//開始重複做畫 | |
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, 200));//xx 為亂數0-200 | |
yy = yy + 1; | |
println("yy:"+yy); //顯示給人看yy的數值 | |
if(yy > height) yy =0; //如果yy 數值大於螢幕的高 就等於零 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment