
Creative Coding (Processing) - Jamie XX Art
Keywords: Interactive Visual Design, Processing, Reactive Art, Programming, Coding
This program aims to provide a recognisable and dynamic visual identity for the artist: Jamie XX.
The generated program involves the user's mouse and keyboard inputs to vary the visual identity and can be used to create unique album art covers or other visuals quickly and effectively with an infinite number of outcomes.
Instructions
Press any key between '1’- ‘0' to change the slice count
Move the mouse around to change the position of the spectrum, note: the mouse can leave the frame
Use the 'Left' and 'Right' Arrow keys to change the rotation
Press the 's' key to save a png image
Generated Artwork












Full Code:
/* Originally created for QUT DXB303 - Programming for Visual Designers * Assessment Two: Major Interactive Work * Addressing Brief 3: Dynamic Visual Identity * * Code has been updated to work for p5.js (created in processing) * * By Asa Meng * * This sketch aims to provide a recognisable and dynamic visual identity for the artist: Jamie XX * The generated sketch involves the user's mouse and keyboard inputs to vary the visual identity * and can be used to generate album art covers or other visuals quickly and uniquely. * * Code adapted from: http://alpha.editor.p5js.org/generative-design/sketches/P_1_1_2_01 by generative-design. * - The colour wheel has been adapted to form the basis of the colour spectrum and has been * modified to allow for keyboard inputs to change the slice count/polygon shape as well as * also tracking the mouseX and Y positions. By clicking and dragging the spectrum outside the * frame, the user can create even more interesting visuals especially when combined with rotation. */ let h = 360; let radius = 3000; let theta = 0.01; let slicecount = 24; function setup() { createCanvas(1000, 1000); frameRate(60); smooth(); noStroke(); colorMode(HSB, 360, 255, 255); print("Press key's '1-0' to change slice count"); print("Move mouse around to change position of spectrum, mouse can leave the frame"); print("Use 'Left' and 'Right' Arrow keys to change rotation"); print("Press the 's' key to save a png image"); } function draw() { push(); //Number input to change the number of slices let slices = 360 / slicecount; rotate(theta); beginShape(TRIANGLE_FAN); vertex(mouseX, mouseY); for (let angle = 0; angle <= 360; angle += slices) { //By adding the position of mouseX/Y, the vertex/slices are drawn parallel to the frame let vx = mouseX + sin(radians(angle)) * radius; let vy = mouseY + cos(radians(angle)) * radius; vertex(vx, vy); //The fill of each slice is dependent on its' angle therefore allowing a distinct spectrum of colours fill(angle, 255, 255); } endShape(); pop(); //JAMIE XX SIGNATURE ELEMENT push(); translate(350, 500); rotate(radians(45)); fill(h, 255, 255); rect(0, 0, 155, 320); //Hue is constantly changing and cycles through the colour spectrum h += 0.2; if (h >= 360) { h = 0; } pop(); } //Enables rotation of the spectrum with the Left and Right arrow keys function keyPressed() { if (keyCode == RIGHT_ARROW) { theta = theta + 0.02; } if (theta >= 2 * PI) theta = 0; if (keyCode == LEFT_ARROW) { theta = theta - 0.02; } if (theta >= 2 * PI) theta = 0; } //Key press options to quickly change the slice count and subsequent hue of the spectrum function keyReleased() { if (key == 's' || key == 'S') { save("JamieXX.png"); } //Saves an image when the S key is pressed if (key == '1') { slicecount = 24; } //24 Slices (Jamie XX Album Cover default) if (key == '2') { slicecount = 4; } //4 Slices if (key == '3') { slicecount = 8; } //8 Slices if (key == '4') { slicecount = 10; } //10 Slices if (key == '5') { slicecount = 12; } //12 Slices if (key == '6') { slicecount = 30; } //30 Slices if (key == '7') { slicecount = 60; } //60 Slices if (key == '8') { slicecount = 90; } //90 Slices if (key == '9') { slicecount = 180; } //180 Slices if (key == '0') { slicecount = 360; } //360 Slices }