Tenth TAD project. This is a variation of Tuesday’s project. I wrote it as a prelude to a test interface I am developing for a device to showcase later. To operate, press the ‘1’ key on your keyboard to rotate the ring to the left; press ‘2’ to rotate to the right; press ‘0’ to stop the rotation; press ‘4’ to show/hide the center sigil. (The rotation is jerky online. I need to sort out what that is about.)
Source code:
/** ResponsiveSigils * by Joshua Madara, hyperRitual.com * Press 1 to rotate ring to the left * Press 2 to rotate ring to the right * Press 0 to stop rotating ring * Press 4 to toggle the sigil in/visisble * Sigils drawn in GIMP with brushes by * http://redheadstock.deviantart.com/ */ PImage ring; PImage sigil; float counter = 0; // count rotation int sw1 = 0; // switch 1 state variable int sglAlpha = 0; // sigil alpha value void setup() { size(400, 400); ring = loadImage("ring.png"); sigil = loadImage("sigil.png"); imageMode(CENTER); } void draw() { background(0); //switch to control rotation of ring switch(sw1) { case 0: // stop rotating rotateRing(counter); break; case 1: // rotate left counter-=0.005; rotateRing(counter); break; case 2: // rotate right counter+=0.005; rotateRing(counter); break; } // show/hide sigil pushMatrix(); tint(255, sglAlpha); image(sigil, width/2, height/2); popMatrix(); } void keyPressed() { if(key == '0') { sw1 = 0; } else if(key == '1') { sw1 = 1; } else if (key == '2') { sw1 = 2; } else if(key == '4') { if(sglAlpha == 0) {sglAlpha = 255;} else {sglAlpha = 0;} } } void rotateRing(float dir) { pushMatrix(); translate(width/2, height/2); rotate(dir); noTint(); image(ring, 0, 0); translate(-width/2, -height/2); popMatrix(); }