// T H E
// ____ __ ____
// /\ _\ /'\_/'\ /\ \__ /\__ \
// \ \ \/ /\ \ __\ \ ,_\ __ \/_/\ \
// \ \ \ \ \ \__\ \ /'__'\ \ \/ /'__'\ \ \ \
// \ \ \_ \ \ \_/\ \/\ __/\ \ \_/\ \L\.\_ \_\ \
// \ \___\ \ \_\\ \_\ \____\\ \__\ \__/.\_\ /\___\
// \/___/ \/_/ \/_/\/____/ \/__/\/__/\/_/ \/___/
// ______________________________________________________
// | |
// | ! I N S T R U C T I O N S #5 |
// |______________________________________________________|
// | |
// | This OBJKT DOES NOT take its description metadata |
// | to execute it as code to render its output. |
// | But if it did, this GIF is what it would look like. |
// |______________________________________________________|
// | |
// ################ START OF INSTRUCTIONS ################
background(pieceColors[0]) // -------- Set background color
// ---------------------- Split the instructions into lines
let string = instructions.match(/[^\\r\\n]+/g) // ---------
// -------------------------------- Set the text appearance
textFont('Courier') // ---------------------------- Courier
textSize(height/44) // ---------------------- Relative size
fill(pieceColors[1]) // -------------- Either Light or Dark
let percent = float((frameCount-1%string.length) % string.length)
/ string.length // --- Calculate the percentage out of the
let angle = percent * TWO_PI; // -------- the total frames
// ------- Calculate the coordinates for a rotating circle
let xOff = ceil(13 * cos(angle)) // ----------------------
let yOff = ceil(13 * sin(angle)) // ----------------------
// -------------------------- Set a rolling starting index
let start = frameCount%string.length // ------------------
// ----- While rendering each line of the instructions for
for(let i=0;i<string.length;i++){ // ---------- each frame
let line = string[(start+i)%string.length] // ------------
// Insert a ball of random chars in the coordinates of the
// rotating circle ---------------------------------------
let x = floor(69/2)+xOff // (Note to self: 76 is actually
let y = floor(32/2)+yOff // -------------- the char width)
if(i==y-1 || i==y+1){ // ---------------------------------
line = [line.slice(0, x),' '+random().toString(36).substr(2, 3)
+' ', line.slice(x)].join('')} // -----------------------
if(i==y){ // ---------------------------------------------
line = [line.slice(0, x),' '+random().toString(36).substr(2, 5)
+' ', line.slice(x)].join('')} // ------------------------
// --------------------------------------- Render the line
text(line,2,-2+(i*(height/32)))} // ----------------------
// ################# END OF INSTRUCTIONS #################
// |______________________________________________________|
// | |
// | Clicking anywhere doesn't do anything. |
// | It's a GIF. |
// | |
// | Made in p5js |
// |______________________________________________________|
// | |
// | 5 Aug 2021 @Yazid |
// |______________________________________________________|