float r=0; void setup() { size(400, 400); background(0); smooth(); noStroke(); } void draw() { if (r>300) { // To reset the drawing fill(0); r=0; rect(0, 0, width, height); } rotate(r); translate(width/2, height/2); //to bring it to center fill(0, random(r, 255), random(r, 255)); float circle_size= random(5, 15); ellipse(100+r, 10, circle_size, circle_size); r=r+0.2; }
Showing posts with label java animation. Show all posts
Showing posts with label java animation. Show all posts
Friday, 25 May 2018
Simple processing Generative Art/Drawing 4
Tuesday, 8 May 2018
Cafe Wall Illusion using processing
Cafe Wall Illusion
int s=89; color black=color(0); color white=color(255); Line l[]; float update=0; void setup() { size(810, 680); stroke(89, 89, 89); strokeWeight(2); l=new Line[8]; for (int i=0; i<8; i++) { l[i]=new Line(i*90); } } void draw() { for (int i=0; i<8; i++) { if (i%2==0) l[i].drawL(-270+update); else l[i].drawL(-270-update); } update=update+0.5; //println(update+""); if (update==180) update=0; } class Line { int n=20; float posY; Line(float posY) { this.posY=posY; } void drawL(float diff) { for (int i=0; i<16; i++) { float posX=i*90 +diff; if (i%2==0) { fill(0); rect(posX, posY, s, s); } else { fill(255); rect(posX, posY, s, s); } } } }
Monday, 30 April 2018
Simple Clock Animation Using Processing(with Code)
Find the code for above video below.
void setup(){
size(800,800);
background(0);
strokeCap(SQUARE);
}
void draw(){
fill(0);
rect(0,0,800,800);
int s=second();
int h=hour();
int m=minute();
String time;
if(h>=10)
time=h+"";
else
time="0"+h;
if(m<10)
time=time+":0"+m;
else
time=time+":"+m;
if(s<10)
time=time+":0"+s;
else
time=time+":"+s;
if(h>12)
h=h-12;
translate(400,400);
rotate(radians(-90));
noFill();
strokeWeight(24);
stroke(255);//Set your Color
arc(0,0,400,400,0,((2*PI)/60)* s);
stroke(255);//Set your Color
arc(0,0,350,350,0,((2*PI)/60)* m);
stroke(255);//Set your Color
arc(0,0,300,300,0,((2*PI)/12)* h);
rotate(radians(90));
PFont font = createFont("Comic Sans MS", 40);
textFont(font);
fill(255);
text(time, -80, 0);
} Sunday, 23 July 2017
Simple Processing Generative Art/Drawing 3
To Generate Above drawing
Note : Play with fill to get different color
float r = 0;
void setup() {
size(400,400);
background(10);
smooth();
noStroke();
}
void draw() {
translate(width/2, height/2);
fill(255);
rotate(r);
float circle_size = random(5, 15);
fill(0,random(r,255),random(r,255));
ellipse(100 + r, 10, circle_size, circle_size);
r = r + 0.2;
println(r);
if(r>150)
r=0;
}
Simple Processing Generative Art/Drawing 2
Code to generate above patten
1. For rectangle
void setup(){
size(600,600);
}
void draw(){
noStroke();
fill(random(255),random(255),random(255),random(255));
rect(random(255),random(255),random(255),random(255));
}
2. For Ellipse
void setup(){
size(600,600);
}
void draw(){
noStroke();
fill(random(255),random(255),random(255),random(255));
ellipse(random(255),random(255),random(255),random(255));
}
Simple Processing Generative Art/Drawing 1
Code to generate above pttern
void setup(){
size(255,255);
}
void draw(){
float r=random(255);
float b=random(255);
float g=random(255);
stroke(r,b,g);
line(0,0,r,b);
}
Subscribe to:
Posts (Atom)