小中
星期四, 11月 30, 2006
NxM eyeballs that look at mouse cursor and change
這眼睛真的很難寫
我是參考了多人的範例所寫出來的!
對CLASS的概念還需要多一點練習
Processing Code:
--------------------------------------
int sCon=5,sRow=4,sColor=4;
sEyes[][] cl_Eye= new sEyes[sCon+1][sRow+1];
void setup()
{
size(200, 200);
smooth();
noStroke();
colorMode(HSB,360,100,100);
for(int i=0; i < sCon; i++)
{
for(int j=0; j < sRow; j++)
cl_Eye[i][j] = new sEyes(i*((width)/(sCon+1)),j*((height)/(sRow+1)));
}
}
void draw()
{
background(0);
for(int i=1; i < sCon; i++)
{
for(int j=1; j < sRow; j++)
cl_Eye[i][j].Display();
}
}
void mouseMoved()
{
for(int i=0; i < sCon; i++)
{
for(int j=0; j < sRow; j++)
cl_Eye[i][j].sChange(mouseX,mouseY);
}
}
void mousePressed()
{
sColor=(int)random(180,270);
for(int i=1; i < sCon; i++)
{
for(int j=1; j < sRow; j++)
cl_Eye[i][j].sChangeColor();
}
}
class sEyes
{
int x, y;
int size,icolor;
float angle = 0.0;
sEyes(int sPosx, int sPosy) {
x = sPosx;
y = sPosy;
icolor=(int)(sColor+random(-30,90));
if(width>=height)
size=height/(sRow+2);
else
size=width/(sCon+2);
}
void sChangeColor()
{
icolor=(int)(sColor+random(180));
}
void sChange(int sx, int sy)
{
angle = atan2(sy-y, sx-x);
}
void Display() {
pushMatrix();
translate(x, y);
fill(255);
ellipse(0,0, size, size);
rotate(angle);
fill(icolor,100,100);
ellipse(size/4, 0, size/2, size/2);
popMatrix();
}
}
--------------------------------------
星期三, 11月 29, 2006
Kandinsky互動
目前只研究出來讓一個物件移動的方式
如果要讓很多的物件一起動的話
應該要使用到類別會比較方便
不過由於目前個人技術的問題
要如何讓多個物件一起移動的話可能還需要一點時間
呵呵~
Processing Code:
----------------------------------------
int size = 50;
float sXpos,sYpos;
float sXspeed = 2.0;
int sXdirection = 1;
void setup()
{
size(379,450);
noStroke();
frameRate(30);
smooth();
sXpos = 105;
sYpos = 46;
}
void draw()
{
background(41,84,57);
smooth();
fill(159,159,39);rect(10,5,13,430);//左方形
fill(226,235,84);rect(33,10,10,420);//右方型
fill(219,45,54);triangle(125,170,90,245,110,250);//左小三角
fill(52,162,63);triangle(125,180,111,250,138,250);//中小三角
fill(219,45,54);triangle(127,170,140,250,160,250);//右小三角
fill(219,45,54);triangle(128,97,95,185,158,188);//上大三角
fill(219,45,54);triangle(123,253,100,415,140,415);//下大三角
fill(43,95,142);triangle(360,366,360,25,340,20);//右藍三角
fill(244,198,76);ellipse(275,380,80,50);//下1橢圓
fill(216,143,48);ellipse(275,350,55,25);//下2橢圓
fill(244,217,16);ellipse(275,332,53,25);//下3橢圓
fill(223,121,55);ellipse(275,319,28,17);//上2橢圓
fill(228,66,41);ellipse(275,303,110,26);//上一橢圓
sXpos = sXpos + ( sXspeed * sXdirection );
if (sXpos > 140 || sXpos < 60) {
sXdirection *= -1;
}
fill(106,185,70);ellipse(sXpos+size/2, sYpos+size/2, size, size);
}
-------------------------------------
Victor Vasarely
本學期到目前為止老師已經為我們介紹了三位大師
Kandinsky、Piet Mondrian
第三位大師是 Victor Vasarely
第一次看到他的作品的時候只有一種感覺
怎麼那麼帥!
Vasarely出生於1906年4月9號
他的畫風可以說是非常現代
甚至把他的畫拿到現今來畫
都覺得非常的有趣
基本的方格、圓形、大小的排列、顏色明亮度的變化
可說是使用的淋漓盡致
尤其是他利用大小,讓2D畫面做到3D的感覺
使的在20世紀初的作品,增添了許多的未來、現代感!
他的作品就目前我們學的Processing
可以利用類別與迴圈就可以快速的複製出相同效果的模仿品
不過還是要對這位大師至上一份尊敬的心
竟可以在電腦還未發明前就已經有這樣驚人的想法與創造力
利用一筆一劃就將這麼精采的作品給畫出來
而在1930~1970短短的30年間
就做出了超過500張的作品!
可說是非常的快速~
而且在1987年!這位大師就有了兩座博物館
真令我感到驚訝
但Vasarely在1997年3月離開了人世
不過他的作品,卻會流傳千古
他的作品就目前我們學的Processing
可以利用類別與迴圈就可以快速的複製出相同效果的模仿品
不過還是要對這位大師至上一份尊敬的心
竟可以在電腦還未發明前就已經有這樣驚人的想法與創造力
利用一筆一劃就將這麼精采的作品給畫出來
而在1930~1970短短的30年間
就做出了超過500張的作品!
可說是非常的快速~
而且在1987年!這位大師就有了兩座博物館
真令我感到驚訝
但Vasarely在1997年3月離開了人世
不過他的作品,卻會流傳千古
星期一, 11月 27, 2006
Piet Mondrian
訂閱:
文章 (Atom)

