Week 3 Assignment – Shanaia Paruthi

Description

Create a generative artwork using Object-Oriented Programming.

Process

I started with setting the background as black. This particular design has a monochrome theme, therefore I have only used the shades of black and white for this assignment.

I started by creating a spiral starting from the centre of the screen using the ellipse shape and sin and cos function to move it. I then created a circle in the centre and put its colour in a loop to give it an effect.

The main part of my design consisted of rotating square in the centre. By putting the square in a loop and a strokeWeight of 10, the square got its special effect. Then I increased the square angle  by 0.1 with every  frame.

VIDEO TO MY WORK:

https://youtu.be/lZz2NTa6jeU

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
//introducing variables
float r = 0;
float theta = 0;
float angle;
void setup() {
//setting the display size
size(640, 480);
background(0);//black
fill (256/2,80); //grey
circle(0, 0, 150);
}
void draw() {
spiral();
center(250);
square();
}
void spiral(){
//defining x coordinate to move the ellipse
float x = r * cos(theta);
//defining the y coordinate to move the ellipse
float y = r * sin(theta);
noStroke();
//defning stroke Weight
strokeWeight(0.5);
//filling colour
fill(random(100,150));
translate(width/2,height/2);
//creating the ellipse
ellipse(x, y, 30, 30);
//increment of angle
theta += 0.1;
//increment of radius of the spiral
r += 0.5;
}
void center(float h) {
//defining the center circle
h-= 5;
circle(0, 0, h+60);
//giving it a zooming effect
for (int i=0; i<angle; i++) {
fill(100,80);
line(h, h-2, h, i);
}
}
void square(){
//creating a loop
for (int i=0; i<100; i++) {
fill(random(100, 180), 85);
stroke(0);
strokeWeight(10);
//scaling the square
scale(0.95);
//rotate
rotate(radians(angle*1.5));
//creating a rectangle
rect(0, 0, 150, 150);
}
//increment of the angle
angle+= 0.1;
}
//introducing variables float r = 0; float theta = 0; float angle; void setup() { //setting the display size size(640, 480); background(0);//black fill (256/2,80); //grey circle(0, 0, 150); } void draw() { spiral(); center(250); square(); } void spiral(){ //defining x coordinate to move the ellipse float x = r * cos(theta); //defining the y coordinate to move the ellipse float y = r * sin(theta); noStroke(); //defning stroke Weight strokeWeight(0.5); //filling colour fill(random(100,150)); translate(width/2,height/2); //creating the ellipse ellipse(x, y, 30, 30); //increment of angle theta += 0.1; //increment of radius of the spiral r += 0.5; } void center(float h) { //defining the center circle h-= 5; circle(0, 0, h+60); //giving it a zooming effect for (int i=0; i<angle; i++) { fill(100,80); line(h, h-2, h, i); } } void square(){ //creating a loop for (int i=0; i<100; i++) { fill(random(100, 180), 85); stroke(0); strokeWeight(10); //scaling the square scale(0.95); //rotate rotate(radians(angle*1.5)); //creating a rectangle rect(0, 0, 150, 150); } //increment of the angle angle+= 0.1; }
//introducing variables 
float r = 0;
float theta = 0;
float angle;

void setup() {
  //setting the display size
  size(640, 480);
  
  background(0);//black
  fill (256/2,80); //grey
  circle(0, 0, 150);
}

void draw() {
  
  spiral();
  
  center(250);
  
  square();
}

void spiral(){
  //defining x coordinate to move the ellipse
   float x = r * cos(theta);
   //defining the y coordinate to move the ellipse
  float y = r * sin(theta);

  
  noStroke();
  //defning stroke Weight
  strokeWeight(0.5);
  //filling colour
  fill(random(100,150));
  translate(width/2,height/2);
  
  //creating the ellipse
  ellipse(x, y, 30, 30); 

  //increment of angle
  theta += 0.1;
  //increment of radius of the spiral
  r += 0.5;
}

void center(float h) {
  //defining the center circle 
  h-= 5;
  circle(0, 0, h+60);
  //giving it a zooming effect
  for (int i=0; i<angle; i++) {
    fill(100,80);
    line(h, h-2, h, i);
  }
  
  
}
void square(){
  //creating a loop
  for (int i=0; i<100; i++) {
    fill(random(100, 180), 85);
    stroke(0);
    strokeWeight(10);
    //scaling the square
    scale(0.95);
    
    //rotate
    rotate(radians(angle*1.5));
    
    //creating a rectangle
    rect(0, 0, 150, 150);
  }
  //increment of the angle
  angle+= 0.1;
}

 

Leave a Reply