1.
void setup() // 設定視窗大小
{
size ( 600, 400 );
}
void draw ()
{
for ( int x = 0 ; x < 600 ; x += 100) // 利用雙層for迴圈 來讓正方形填滿視窗
{
for ( int y = 0 ; y < 400 ; y += 100)
{
rect (x, y, 100, 100 ) ; // 畫出正方形
}
}
}
2.
{
size ( 600, 400 );
}
void draw ()
{
for ( int x = 0 ; x < 600 ; x += 100) // 利用雙層for迴圈 來讓正方形填滿視窗
{
for ( int y = 0 ; y < 400 ; y += 100)
{
rect (x, y, 100, 100 ) ; // 畫出正方形
triangle(x+30, y+75, x+58, y+20, x+86, y+75) ; // 在每一個方塊中加入三角形
}
}
3.
void setup()
{
size ( 600, 400 );
}
void draw ()
{
for ( int x = 0 ; x < 600 ; x += 100)
{
for ( int y = 0 ; y < 400 ; y += 100)
{
fill(255 , 255 , 0) ; // 設定方形的顏色
rect (x, y, 100, 100 ) ;
fill(0 , 0 , 255 , 100 ) ; // 設定三角形的顏色
triangle(x+30, y+75, x+58, y+20, x+86, y+75);
fill (255 , 0 , 0 , 100) ; // 設定圓形的顏色
ellipse(x+58, y+55, 55, 55);
}
}
}
3.
void setup()
{
size ( 600, 400 );
}
void draw ()
{
for ( int x = 0 ; x < 600 ; x += 100)
{
for ( int y = 0 ; y < 400 ; y += 100)
{
fill(255 , 255 , 0) ;
rect (x, y, 100, 100 ) ;
fill(0 , 0 , 255 , 100 ) ;
triangle(x+30, y+75, x+58, y+20, x+86, y+75);
fill (255 , 0 , 0 ,dist(x, y , mouseX , mouseY) *2) ; // 使用滑鼠來控制透明度
ellipse(x+58, y+55, 55, 55);
}
}
}
void setup()
{
size ( 600, 400 );
}
void draw ()
{
for ( int x = 0 ; x < 600 ; x += 100)
{
for ( int y = 0 ; y < 400 ; y += 100)
{
fill(255 , 255 , 0) ;
rect (x, y, 100, 100 ) ;
fill(0 , 0 , 255 , 100 ) ;
triangle(x+30, y+75, x+58, y+20, x+86, y+75);
fill (255 , 0 , 0 ,dist(x, y , mouseX , mouseY) *2) ; // 使用滑鼠來控制透明度
ellipse(x+58, y+55, 55, 55);
}
}
}
4.希望可以在這堂課上學習到很多關於互動的程式教學
沒有留言:
張貼留言