-
-
Save ff6347/10c775675f61e264c594359a3b44bd1f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var actualCharacter = -1; | |
| var alphabet = 'abcdefghijklmnopqrstuvwxyz!?1234567890 '; | |
| var word = window.prompt('Please a word or sentence you think is funny', | |
| 'badibaduba'); | |
| function setup() { | |
| colorMode(HSB, alphabet.length, word.length, 1, 1); | |
| createCanvas(windowWidth, windowHeight); | |
| } | |
| function colorizeByCharacter(character) { | |
| var positionInAlphabet = alphabet.indexOf(character); | |
| var positionInWord = actualCharacter; | |
| background(positionInAlphabet, positionInWord, 1, 0.3); | |
| } | |
| function draw() { | |
| actualCharacter = actualCharacter < word.length - 1 ? actualCharacter + 1 : -1; | |
| colorizeByCharacter(word.split('')[actualCharacter]); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment