WCCC_Errors

ErrorFilledBuild

For this week's Creative Code challenge by @sableraph : “Errors,”, ErrorFilledBuild is visually coded in Enu & P5js . Enu is used for the 3d worldbuilding and unusual architecture errors while the P5js sketch enforces the error filled world by added extra glitches. Combined with effects, ErorrFilledBuild contains many “errors”. Audio Coded with SonicPi.

Poetry

Errors are drawn
Errors are known
While some are not
Can be annoying as a knot
But some let ideas spawn
Into a creative zone

Video

Code

Enu

import math

name tower(height = 15..70, width = 1..15, length = 1..20, sides = 1..4, twist = -5..15)
speed = 0
height.times:
  sides.times:
    forward length
    forward width
    turn 360 / sides + twist
  up 1..3


drawing = false
seed = cycle(213,19,116,450)
speed = 0
turn right

15.times(i):
  forward 1..79
  turn 20..90
  turn right
  turn left
  tower.new(
    height = 5..47, 
    length = 5..17, 
    sides = 3..22,
    twist = -25..25, 
    color = cycle(red, green, red, blue, black,blue)
  )

P5js

function setup() {
  createCanvas(windowWidth, windowHeight);
}

let colors = [
  "blue",
  "red",
  "yellow",
  "green",
  "white",
  "rouge",
  "blanc",
  "jaune",
  "bleu",
  "vert",
];
let colors2 = [
  "purple",
  "black",
  "orange",
  "teal",
  "maroon",
  "green",
  "blue",
  "white",
  "black",
  "brown",
  "blanchedAlmond",
];

let textStyles = [
  "Georgia",
  "Helvetica",
  "Times",
  "Comic Sans MS",
  "sans-serif",
  "monospace",
  "serif",
  "cursive",
  "fantasy",
  "Trebuchet MS",
];

function draw() {
  frameRate(2);

  textSize(140);

  //put the randomness and variables in the loop, so it goes thru
  for (let i = 0; i < 25; i++) {
    colors_list = random(colors);
    colors_list2 = random(colors2);

    fill(colors_list2);
    stroke(colors_list);
    strokeWeight(random(1, 4));
    textAlign(CENTER);
    textFont(random(textStyles));
    text(
      colors_list,
      width / 2 + random(-800, +800),
      height / 2 + random(-800, +800)
    );

    if (i % 10 == 0) {
      //string reversal with commas
      text(
        colors_list.split("").reverse().join(),
        width / 2 + random(-800, +800),
        height / 2 + random(-800, +800)
      );
    }
    if (i % 6 == 0) {
      //string reversalwithout commas
      text(
        colors_list.split("").reverse().join(""),
        width / 2 + random(-800, +800),
        height / 2 + random(-800, +800)
      );
    }
  }
}
function keyPressed() {
  if (key === "w") {
    filter(BLUR, int(random(1, 3))); // different photo filters
  }

  if (key === "s") {
    filter(ERODE, random(0, 3)); // different photo filters
  }

  if (key === "a") {
    filter(DILATE, random(0, 3)); // different photo filters
  }

  if (key === "e") {
    background("grey");
  }

  if (key === "d") {
    filter(INVERT); // different photo filters
  }

  if (key === "s") {
    save("myCanvas.jpg");
  }
}

// allow for fullscreen without switching
function mousePressed() {
  if (
    mouseX > 0 &&
    mouseX < windowWidth &&
    mouseY > 0 &&
    mouseY < windowHeight
  ) {
    let fs = fullscreen();
    fullscreen(!fs);
  }
}

SonicPi


live_loop :changeGameTunes do
  use_random_seed Time.now.to_i
  use_bpm  120
  with_fx [:ping_pong,:wobble].tick, mix: 0.65 do
    with_fx :ixi_techno , mix: [0.6,0.3,0.1].tick do
      with_fx :reverb, mix: 0.7, pre_mix: 0.4 do
        synth [:pretty_bell,:piano,:hollow,:piano].choose if spread(3,8).mirror.shuffle
        play scale(44, :minor).choose
        sleep [0.5,1,2].choose
      end
    end
  end
end
0
Subscribe to my newsletter

Read articles from Kofi / Illestpreacha directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Kofi / Illestpreacha
Kofi / Illestpreacha