dpo­n­3­7­5­4­_­a­s­s­e­s­s­m­e­n­t­0­1

by Danielle Pontes

"Planetary"

Movement and Energy | Danielle Pontes | dpon3754 | IDEA 9103 | Assessment 1

Final results:

  • Show Sketch
/** @peep sketchcode */
 
 
//canvas size of 400x400 pixels with black background
size(400,400);
background(0); 
 
for(int i=0; i<300; i++)      //loop to iterate 300 times and draw 300 very faint ellipses to imitate the milky way
{
  drawMilkyWay(random(400), random(400), random(300),random(width/20)); 
  //parameter 1: random x coordinate between 0 and 400
  //parameter 2: random y coordinate between 0 and 400
  //parameter 3: random diameter between 0 and 300
  //parameter 4: random strokeWeight between 0 and 20
}
 
noStroke();     //setting all functions from here on to have no stroke
 
float d=random(120,250);   //random variable determining diameter, placed outside recursion loop to maintain consistent diameter for all 3 big planets
for(int i=0; i<3; i++)    // loop to iterate 3 times and draw 3 big planets
{
  drawBigPlanet(random(30,370), random(30,370), d);      //calling "drawBigPlanet" with parameters 
  //parameter 1:random x coordinate between 30 and 370 
  //parameter 2:random y coordinate between 30 and 370 
  //parameter 3:random diameter between 120 and 250 
}
 
float d2=random(30,60);   //random variable determining diameter, placed outside recursion loop to maintain consistent diameter for all 5 small planets
for(int i=0; i<5; i++)    // loop to iterate 5 times and draw 5 small planets
{
  drawSmallPlanet(random(30,370), random(30,370), d2);      //calling "drawSmallPlanet" with parameters 
  //parameter 1:random x coordinate between 30 and 370 
  //parameter 2:random y coordinate between 30 and 370 
  //parameter 3:random diameter between 30 and 60 
}
 
float d3=random(70,90);   //random variable determining diameter, placed outside recursion loop to maintain consistent diameter for all 5 medium planets 
for(int i=0; i<5; i++)    // loop to iterate 5 times and draw 5 medium planets
{
  drawBigPlanet(random(30,370), random(30,370), d3);      //calling "drawMediumPlanet" with parameters 
  //parameter 1:random x coordinate between 30 and 370 
  //parameter 2:random y coordinate between 30 and 370 
  //parameter 3:random diameter between 70 and 90 
}
 
for(int i=0; i<5;i++)     // loop to iterate 5 times and draw 5 stars
{
  drawSmallStar(random(30,370), random(30, 370), (int)random(5,8), (int)random(10,13), (int)random(5,8));
  //parameter 1:random x coordinate between 30 and 370 
  //parameter 2:random y coordinate between 30 and 370 
  //parameter 3:random distance between center point of star and inner points of star ranging from 5-8
  //parameter 4:random distance between center point of star and outer points of star ranging from 10-13
  //parameter 5:random integer determining the amount of outer points the star will have ranging between 5 and 8
}  
 
/* function called "drawMilkyWay" that draws ellipses to create a "galaxy" background:
-Location is determined by passed parameter float x and y
-Diameter is determined by passed parameter fload d
-Strokeweight of each ellipse is determined by passed parameter float r
*/
void drawMilkyWay(float x, float y, float d, float r)
{
  noFill();     //setting each ellipse to have no fill 
  stroke(0,100,random(255),8);     //setting stroke color and opacity 
  strokeWeight(r);      //setting stroke weight of each ellipse
  ellipse(x,y,d,d);     //calling command to draw ellipse
}  
 
/*
function called "drawBigPlanet" that draws ellipses:
-Location is determined by passed parameter float x and y
-Diameter is determined by passed parameter float d
-Fill colors vary between blues and greens,
 as determined by random fill where red varies between 0-255, green remains at 0, and blue remains at 100.
-The circles have an opacity ranging from 47-78% as determined by randomized 4th parameter of fill().
*/
void drawBigPlanet(float x, float y, float d)
{
    fill(random(255),0,230,random(120,175));  //setting fill color and opacity
    ellipse(x,y,d,d);             //calling command to draw ellipse
}
 
/*
function called "drawMediumPlanet" that draws ellipses:
-Location is determined by passed parameter float x and y
-Diameter is determined by passed parameter float d3
-Fill colors vary between blues and greens,
 as determined by random fill where red varies between 0-255, green remains at 0, and blue remains at 100.
-The circles have an opacity ranging from 47-78% as determined by randomized 4th parameter of fill().
*/
void drawMediumPlanet(float x, float y, float d3)
{
  fill(random(255),100,230,random(120,175));  //setting fill color and opacity
  ellipse(x,y,d3,d3);             //calling command to draw ellipse
}
 
/*
function called "drawSmallPlanet" that draws ellipses:
-Location is determined by passed parameter float x and y
-Diameter is determined by passed parameter float d2
-Fill colors vary between blues and greens,
 as determined by random fill where red remains at 0, green remains at 230 and blue varies between 0-255.
-The circles have an opacity ranging from 47-78% as determined by randomized 4th parameter of fill().
*/
void drawSmallPlanet(float x, float y, float d2)
{
  fill(0,230,random(255),random(120,175));  //setting fill color and opacity
  ellipse(x,y,d2,d2);           //calling command to draw ellipse
}  
 
/*
function called "drawSmallStar" that draws a star:
-Location is determined by passed parameter float x and y
-size is determined by passed parameter integer inner and outer
-number of points is determined by passed parameter integer p
-Fill colors vary between blues and greens,
 as determined by random fill where red remains at 0, green remains at 230 and blue varies between 0-255.
-The star has an opacity ranging from 47-78% as determined by randomized 4th parameter of fill().
-Code to draw basic star borrowed from Tutorial 7: Drawing with Functions, part 2:A custom drawing function
-altered with randomization and formatting
*/
void drawSmallStar(float x, float y, int inner, int outer, int p) 
{    
    fill(0,230,random(255),random(120,175));  //setting fill color and opacity
    beginShape();           //begin to create a shape based on vertex points 
    float delta = radians(360/p);   //setting the angle between each offshoot of the star at an equal angle depending on the amount of random points the star has
    for (int j = 0; j < p; j++)     //a loop to traverse through each point that the star will have, determinig its x and y values
    {
      float ox = x + outer * cos(j*delta);  //determines the outer x coordinates of the star
      float oy = y + outer * sin(j*delta);  //determines the outer y coordinates of the star
      vertex(ox, oy);                       //the resulting vertex will be included as a point on the shape
 
      float ix = x + inner * cos(j*delta + delta/2);      //determines the inner x coordinates of the star
      float iy = y + inner * sin(j*delta + delta/2);      //determines the inner y coordinates of the star
      vertex(ix, iy);                                     //the resulting vertex will be included as a point on the shape
    }  
    endShape(CLOSE);      //enclose area surrounded by resulting vertexes     
}
For this assignment, I wanted to create a brand called "Planetary", where each individual can get a customized solar system printed on a white t-shirt bound by a black bounding box 400x400. Each person's solar system will contain 3 large planets, 5 medium planets, 5 small planets, and 5 small stars with various amounts of points.
The color scheme is very "galactic" and ranges between pinks, purples, blues, and greens. Each of the planets has various random opaicities to create depth and interesting cross sections as the planets and stars being overlapping and crossing paths. The location of every planet and star is completely randomized, within the parameters of the bounding box, by the different functions which control each set of elements, and the color ranges chosen for each set of planets and stars, also randomized within the galactic color scheme parameters, complement one another so as to never have a "bad" or "ugly" variation.
As the planets form random groupings and clusters, along with the little stars scattering through the canvas and catching the eye as a small but noticable point of difference, there is a universal movement and energy captured in each snapshot. It is like a snapshot of a single moment in the solar system's life and the viewer can just imagine the planets moving about their orbits in space. The transparency of the planets and stars really lends to this effect as it implies movement between the elements, like in real life how the moon can eclipse the sun, they can imagine the planets eclipsing each other for a brief moment and then carrying on across the universe.
The technique I used to attack this code was to first write a function for each element I intended to include in the canvas.

<div><br></div>

I first wrote:


-drawBigPlanet()

-drawSmallPlanet()

-drawMediumPlanet()


These had the basics included, like determining the stroke and fill of each planet, determining variables for location and diameter, and filling the ellipse() function with the required parameters. I then called the function as many times as number of elements that I wanted. See the example code below. It displays my very first iteration of code with the original drawBigPlanet() function making 3 planets.


Phase 1:

  • Show Sketch
/** @peep sketchcode */
 
size(400,400);
background(0);
noStroke();
 
float d=random(120,250);
drawBigPlanet();
drawBigPlanet();
drawBigPlanet();
 
void drawBigPlanet()
{
  float x=random(30,270);
  float y=random(30,270);
  fill(random(255),0,100,175);
  ellipse(x,y,d,d); 
}

This function and setup was the basis for my next planet-drawing functions, and I also added in the drawSmallStar() function to create stars. In total, the functions were creating 3 big planets, 5 medium planets, 5 small planets, and 5 small stars, all varying in opacity, color, size, and location, within the parameters set for each. Once the code was running perfectly, I decided to try and clean up the structure of the code itself by adding in recursion loops instead of repeatedly calling each function, and passing parameters through to the functions instead of defining them all within each function. This eliminated unnecessary repetition and excess lines of code. This gave me the very succinct final code that you see in the final result.



While I was happy with the design at this stage, after looking at examples from Fathom's project "Watch Faces", and Complexification's project "Intersection Momentary", I was really intrigued by the negative space in the ellipses Fathom used, and I loved the "galaxy/stars in the night sky" feeling that Complexification captured.



This inspired me to push further by adding a function that drew a "milky way" background behind the solar system, which was composed of extremely low opacity ellipses with no fill and randomly varying stroke weights ranging from colors within the same galactic color scheme. This created an almost smoke-like haze that resembles our very own Milky Way galaxy. I had to experiment with the potential diameters and stroke weights and opacity levels to get the right level of subtly, whispiness, and distribution. See drawMilkyWay() as a stand-alone element below.

  • Show Sketch
/** @peep sketchcode */
 
 
//canvas size of 400x400 pixels with black background
size(400,400);
background(0); 
 
for(int i=0; i<300; i++)      //loop to iterate 300 times and draw 300 very faint ellipses to imitate the milky way
{
  drawMilkyWay(random(400), random(400), random(300),random(width/20)); 
  //parameter 1: random x coordinate between 0 and 400
  //parameter 2: random y coordinate between 0 and 400
  //parameter 3: random diameter between 0 and 300
  //parameter 4: random strokeWeight between 0 and 20
}
 
void drawMilkyWay(float x, float y, float d, float r)
{
  noFill();     //setting each ellipse to have no fill 
  stroke(0,100,random(255),8);     //setting stroke color and opacity 
  strokeWeight(r);      //setting stroke weight of each ellipse
  ellipse(x,y,d,d);     //calling command to draw ellipse
}

<div><br></div> This concludes my assessment 1.Thank you

Danielle Pontes dpon3754 IDEA 9103 Assessment 1

Comments

Nobody has said anything yet.