DEV Community

Masato Ohba
Masato Ohba

Posted on

Learning Generative Art; day 4 "Flower on a Lofty Height" ๐ŸŒป

Continuation of My first step in learning Generative Art.

"Flower on a Lofty Height"

blue
yellow

I drew an image expressing a flower on a lofty height; I wonder if there is a flower that varies its color during one day.

function setup() {
  createCanvas(800, 700);
  // background(48);
  petals();
  stalk();
}

function petals() {
  // noStroke();

  for (var i = 0; i < 200; i++) {
    var r = random(600);
    // fill(color(random(200, 255), random(200, 255), random(255), 78)) // yellow
    fill(color(random(255), random(200, 210), random(200, 255), 78)) // blue

    beginShape();
    curveVertex(0, 0);
    curveVertex(400, 350);
    curveVertex(random(400), random(600));
    curveVertex(random(400), random(400));
    endShape();
  }
}

function stalk() {
  for (var i = 0; i < 30; i++) {
    fill(color(144, random(200, 255), 144, 60));
    beginShape();
    curveVertex(400, i);
    curveVertex(400, 350);
    curveVertex(800, 700);
    curveVertex(random(500), random(700));
    endShape();
  }
}
Enter fullscreen mode Exit fullscreen mode

TIL ๐Ÿ“

curveVertex function can draw a complex curve. It's still difficult for me to master. However, such a curve is necessary to draw any kinds of stuff in nature.


I started publishing my artworks on a cool hosting web service, OpenProcessing as well.

Top comments (1)

Collapse
 
sm00g15 profile image
Sm00g15

soooo awesome!