DEV Community

Cover image for Learning Generative Art; day 5 "Unknown Language" 👁‍🗨
Masato Ohba
Masato Ohba

Posted on • Edited on

Learning Generative Art; day 5 "Unknown Language" 👁‍🗨

Continuation of My first step in learning Generative Art.

"Unknown Language"

gif

image

I've tried to express what I feel in a situation of facing an unknown language. On that occasion, I never understand what strangers say, what they think, what they feel. Then I feel incredibly isolated and my eyesight turns out gray.

var xoff = 0.0;
var words = ["Lorem", "ipsum", "dolor", "sit", "amet,", "consectetur", "adipiscing", "elit,", "sed", "do", "eiusmod", "tempor", "incididunt", "ut", "labore", "et", "dolore", "magna", "aliqua.", "Ut", "enim", "ad", "minim", "veniam,", "quis", "nostrud", "exercitation", "ullamco", "laboris", "nisi", "ut", "aliquip", "ex", "ea", "commodo", "consequat.", "Duis", "aute", "irure", "dolor", "in", "reprehenderit", "in", "voluptate", "velit", "esse", "cillum", "dolore", "eu", "fugiat", "nulla", "pariatur.", "Excepteur", "sint", "occaecat", "cupidatat", "non", "proident,", "sunt", "in", "culpa", "qui", "officia", "deserunt", "mollit", "anim", "id", "est", "laborum"];

function setup() {
  createCanvas(800, 400);
  background(220);
  noStroke();
}

function draw() {
  fill(220, 4); // Create an alpha blended background
  rect(0, 0, width, height);

  // Get a noise value based on xoff and scale 
  // it according to the window's width
  var n = xoff * xoff * width;
  // var n = random(0,width);  // another expression

  xoff += 0.01; // With each cycle, increment xoff
  if (n > width) {
    xoff = 0.0; // reset
  }

  fill(color(random(100, 133), random(250), random(200, 255), random(200, 255)));
  ellipse(n, random(height), random(64), random(64));
  text(random(words), n, random(height));
  textSize(random(8, 24));
}
Enter fullscreen mode Exit fullscreen mode

TIL 📝

noise

noise function is another way to introduce randomness into generative art. noise uses Perlin Noise unlike random. It means that we can express more natural texture or behavior than random.

(By the way, I didn't know random function accepts an array as its argument.)

Top comments (0)