Skip to main content

Command Palette

Search for a command to run...

WCCC_AboveBelow

Anagrams, all over

Updated
4 min read
WCCC_AboveBelow

AnagramicViewScape

For this week's Creative Code Challenge by @sableraph: "As Above ,So Below”, AnagramicViewScape remixes code from P5JS, Python  & SonicPi. It uses Anagrams that can be read from bottom to top or top to bottom as the placement of the words that have been anagrammatized are flipped. Determining what it is trying to say is part of the journey.

Poem

Top to Bottom
They read alike
Even though positions change
The words remain in range
As they have simply been arranged
Altering placements with time
Aligning with new columns

Video

https://youtu.be/RAWmvbWbyXM

Code

P5Js

//medium version

function setup() {
  createCanvas(displayWidth, displayHeight);
}

function draw() {
  word_1 = [
    "fleet",
    "cheat",
    "complete",
    "defeat",
    "feat",
    "sheet",
    "streets",
    "conceit",
    "feet",
    "treat",
    "beat",
    "repeat",
    "drumbeat",
    "excrete",
    "athlete",
    "backseat",
  ];

  rhymes = shuffle(word_1);

  background(220);
  textAlign(CENTER);
  textSize(height / 18);
  frameRate(6);
  

  shuff(rhymes[0], 0);
  shuff(rhymes[1], 1);
  shuff(rhymes[2], 2);
  shuff(rhymes[3], 3);
  shuff(rhymes[3], 4);
  shuff(rhymes[2], 5);
  shuff(rhymes[1], 6);
  shuff(rhymes[0], 7);
}

function shuff(x, y) {
  // turn the tring into a char array and then shuffled back into a string

  mixed_str = x.split("");
  word = shuffle(mixed_str);
  flipped = word.join("");

  if (flipped == x) {
    fill("red");
  }
  //this checks if the first 3 letters of the flipped and orginal matches
  else if (flipped.substring(0, 2) == x.substring(0, 3)) {
    fill("green");
  }
  //checking if the word ends with t
  else if (flipped.endsWith("t")) {
    fill("blue");
  } else {
    fill("black");
  }
  text(flipped, width / 2, height / 6 + y * (height / 9));
  
  if (second() % 6 > 3)
    {
    filter(BLUR, 1.3);
    filter(DILATE); 
    }
  else
    {
    filter(BLUR, 0.3);
    filter(ERODE);  
    }

}


//medium version

function setup() {
  createCanvas(displayWidth, displayHeight);
}

function draw() {
  word_1 = [
 "o8o0 DO",
"lllO8oD ",
" oOoOo",
"|!| |",
"0| ! O",
"o  |!",
"|oOoo8",
"O0!!DoO",
" 0l0|",
  ];

  rhymes = shuffle(word_1);

  background("black");
  textAlign(CENTER);
  textSize(height / 18);
  frameRate(6);
  

  shuff(rhymes[0], 0);
  shuff(rhymes[1], 1);
  shuff(rhymes[2], 2);
  shuff(rhymes[3], 3);
  shuff(rhymes[3], 4);
  shuff(rhymes[2], 5);
  shuff(rhymes[1], 6);
  shuff(rhymes[0], 7);
}

function shuff(x, y) {
  // turn the tring into a char array and then shuffled back into a string

  mixed_str = x.split("");
  word = shuffle(mixed_str);
  flipped = word.join("");

  if (flipped == x) {
    fill("red");
  }
  //this checks if the first 3 letters of the flipped and orginal matches
  else if (flipped.substring(0, 2) == x.substring(0, 3)) {
    fill("green");
  }
  //checking if the word ends with t
  else if (flipped.endsWith("t")) {
    fill("orange");
  } else {
    fill("gold");
  }
  text(flipped, width / 2, height / 6 + y * (height / 9));
  
  if (second() % 6 > 3)
    {
    filter(BLUR, 1.3);
    filter(DILATE); 
    }
  else
    {
    filter(BLUR, 0.3);
    filter(ERODE);  
    }

}
//medium version

function setup() {
  createCanvas(displayWidth, displayHeight);
}

function draw() {
  word_1 = [
"🧦🌋🎉🌋",
"🥩🍝🍛🍝🍝🚨",
"🎉🧦🧦🎉🎁🚨🌎",
"🧦🎉🍝🏙",
"🥩🍝🥩🍝",
"🌋🌎🌋🍝🚨🍛🧦",
"🌎🌎🌎🎁",
"🎉🏙🥩🌋🥩🍝🥩🥩",
"🍝🌎🥩🍝"
  ];

  rhymes = shuffle(word_1);

  background("black");
  textAlign(CENTER);
  textSize(height / 18);
  frameRate(3);
  

  shuff(rhymes[0], 0);
  shuff(rhymes[1], 1);
  shuff(rhymes[2], 2);
  shuff(rhymes[3], 3);
  shuff(rhymes[3], 4);
  shuff(rhymes[2], 5);
  shuff(rhymes[1], 6);
  shuff(rhymes[0], 7);
}

function shuff(x, y) {
  // turn the tring into a char array and then shuffled back into a string

  mixed_str = x.split("");
  word = shuffle(mixed_str);
  flipped = word.join("");

  if (flipped == x) {
    fill("red");
  }
  //this checks if the first 3 letters of the flipped and orginal matches
  else if (flipped.substring(0, 2) == x.substring(0, 3)) {
    fill("green");
  }
  //checking if the word ends with t
  else if (flipped.endsWith("t")) {
    fill("orange");
  } else {
    fill("white");
  }
  text(flipped, width / 2, height / 6 + y * (height / 9));
  
  if (second() % 6 > 3)
    {
    filter(BLUR, 1.3);
    filter(DILATE); 
    }
  else
    {
    filter(BLUR, 0.3);
    filter(ERODE);  
    }

}


SonicPi

live_loop :swsh do
  use_bpm 360
  use_random_seed Time.now.to_i / 5
  with_fx :ping_pong, mix: (dice(8) + 1)/9 do
    with_fx :echo, decay: dice(6) do
      use_bpm [160,320].choose
      sample [:guit_em9,:ambi_piano].choose, rate: [-1,1,0.5,1.2].tick, beat_stretch: dice(4) + 0.1
      sleep [8,16,32].choose
    end
  end
end


live_loop :beat do
  use_bpm 240
  use_random_seed Time.now.to_i / 4
  with_fx :whammy,mix: [0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1].tick do
    sample :guit_e_slide, rate: 0.5, attack: dice(4), decay: dice(2),beat_stretch: 4
    sleep [1,2,4,8].choose
  end
end


live_loop :beat1 do
  use_bpm 120
  use_random_seed Time.now.to_i / 4
  with_fx :whammy,mix: [0.1,0.2,0.3,0.4,0.5,0.4,0.3,0.2,0.1].tick do
    sample :ambi_piano, attack: dice(4), decay: dice(2),beat_stretch: 4, amp: 1
    
    sleep [0.5,1,2].choose
  end
end

Python

import random as rd

def symbolize2():

    seq = ['0','!','|','o',' ','O','D','l','8']

    for i in range(9):

        seqAudio = rd.choices(seq, k=24)

        if i % 4 == 0:
            seqAudio1 = ''.join(seqAudio[0:rd.randrange(4,8)]) #sublist
        elif i % 3 == 0:
            seqAudio1 = ''.join(seqAudio[0:rd.randrange(3,7)]) #sublist
        else:
            seqAudio1 = ''.join(seqAudio[0:rd.randrange(5,9)]) #sublist


        print('"' + seqAudio1 +'"')
        
symbolize2()

################


import random as rd

def symbolize2():

    seq = ['🌎','🚨','🌋','🏙','🎁','🧦','🎉','🍝','🥩','🍛']

    for i in range(9):

        seqAudio = rd.choices(seq, k=24)

        if i % 4 == 0:
            seqAudio1 = ''.join(seqAudio[0:rd.randrange(4,8)]) #sublist
        elif i % 3 == 0:
            seqAudio1 = ''.join(seqAudio[0:rd.randrange(3,7)]) #sublist
        else:
            seqAudio1 = ''.join(seqAudio[0:rd.randrange(5,9)]) #sublist


        print('"' + seqAudio1 +'"' + ',')
        
symbolize2()


More from this blog