Worm Clock
The longer this clock is open the more layers it will get. The top of the worm is one third of a millisecond, the bottom is a year, and everything else follows accordingly.
The longer this clock is open the more layers it will get. The top of the worm is one third of a millisecond, the bottom is a year, and everything else follows accordingly.
I made a clock where each division of time is one half period of a sin wave. From top to bottom there are milliseconds, seconds, minutes, and hours. I made it smoothly transition by fractional parts of a second. Originally I was going to modulate all of them together, but the time was not decipherable from the resulting wave.
clair chin target clock
each section of my target changes color within a range gradually here’s 12:29-12:31.
float secondHsbVal;
void setup() {
size(600, 600);
strokeWeight(35);
stroke(0);
}
void draw() {
colorMode(HSB,360,100,100);
background(0);
float s = map(second(), 0, 60,178, 302);
float m = map(minute(), 0, 60, 61, 245);
float h = map(hour(), 0, 24, 310, 160);
fill(s,54,99);
ellipse(300,300,600,600);
fill(m,75,99);
ellipse(300,300, 400, 400);
fill(h,73,99);
ellipse(300, 300,200, 200);
}
This is a one-hour sample of a full 24 hour clock (because what even are arrays??? The way I know how, it would have taken me 300 lines HA). Each hour has a different artist/playlist corresponding with the time of day. The hours are divided only by the song and not the actual minutes and seconds.
void setup() {
size(600, 150);
}
void draw () {
background (0);
strokeWeight (3);
noFill();
rect (50, 50, 200, 100);
//int S= ( (((hour()*60) +minute()) *60) +second() );
int S = second()+ 250;
println (S);
textAlign(CENTER);
PFont font;
font = loadFont("OratorStd-Slanted-48.vlw");
textFont(font);
textSize(18);
fill (255);
if (S<=257) {
text("Beyoncé \"Pretty Hurts \"", 300, 75);
} else if (S<=626) {
text("Beyoncé \"Haunted \"", 300, 75);
} else if (S<= 1001) {
text("Beyoncé \"Drunk In Love (feat. Jay-Z) \"", 300, 75);
} else if (S<= 1504) {
text("Beyoncé \" Blow\"", 300, 75);
} else if (S<= 1895) {
text("Beyoncé \"Partition \"", 300, 75);
} else if (S<= 2273) {
text("Beyoncé \" Jealous\"", 300, 75);
} else if (S<= 2524) {
text("Beyoncé \"Mine(feat. Drake)\"", 300, 75);
} else if (S<= 2800) {
text("Beyoncé \" ***Flawless (feat. Chimamanda Ngozi Adiche)\"", 300, 75);
} else if (S<=3030 ) {
text("Beyoncé \"Superpower (feat. Frank Ocean) \"", 300, 75);
} else if (S<= 3296) {
text("Beyoncé \" Heaven\"", 150, 100);
} else if (S<=3600 ) {
text("Beyoncé \" Blue (feat. Blue Ivy)\"", 300, 75);
}
}
My clock concept underwent some serious changes as it progressed. At first, my plan was to have a city which built itself and then destroyed itself every 24 hours, as shown in the schematics below:
Using toxiclibs, I managed to create a class which would create a flat plane in 3D space. As time progressed, boxes would emerge from the plane and grow upwards to a predetermined stop height. The problem was that if the plane was slanted in any direction, the boxes would still go straight up. I spent roughly 12 hours trying to fix this, but without any specific plan or debugging methodology, I only managed to waste loads of time and create more errors with the box generation. I ditched the idea of boxes for lines, which were much less time consuming to deal with. In the end, I managed to create a class which would accept any mesh, and generate lines which grow out of the given mesh in a specific direction. Thus, when a mesh that looks like this:
is fed into the class, this is the result:
captured in motion:
I inserted a shape into a 3D environment:
Originally, I planned to make the lines simply grow in different directions based on the time of day, but that didn’t seem to involve the surrounding terrain at all. Instead, I raised the shape high above the land, and altered the topography:
The beam of light moves to predetermined points (the intersections of the crevices between hills) around the terrain once per minute. A sped up section of random movement is shown here:
While at these points, the light will distort the surface of the terrain in one of five ways:
Every hour, the mesh is reset. One can look at the mesh and, judging its degree of distortion, tell how far into the current hour one is. Implementing a way to tell which hour is the next step, but currently this is only a one hour clock.
Here is a timelapse of the clock in action:
Code:
import toxi.color.*;
import toxi.color.theory.*;
import toxi.physics2d.constraints.*;
import toxi.physics.*;
import toxi.physics.constraints.*;
import toxi.physics.behaviors.*;
import toxi.math.conversion.*;
import toxi.geom.*;
import toxi.math.*;
import toxi.util.datatypes.*;
import toxi.util.events.*;
import toxi.geom.mesh.subdiv.*;
import toxi.geom.mesh.*;
import toxi.math.waves.*;
import toxi.util.*;
import toxi.math.noise.*;
import java.util.*;
import toxi.processing.*;
import java.util.*;
import processing.opengl.*;
int timeChange;
Viewer v;
Mesh3D shape;
ToxiclibsSupport gfx;
SuperStructure struc;
VerletPhysics world;
Land land;
Agent3D zapPos;
int imginc, curMin, curHour;
void setup(){
size(1700,1000,OPENGL);
v = new Viewer(-1280,-776,-1109, new Vec3D());
struc = new SuperStructure(0,-1000,0,(TriangleMesh)new AABB(20).toMesh(),new Vec3D(0,1,0),100,83,2000,1);
gfx = new ToxiclibsSupport(this);
world = new VerletPhysics();
land = new Land(0,50,0,new Vec3D());
imginc = 0;
timeChange = 0;
zapPos = new Agent3D(0,0,0,new Vec3D());
zapPos.maxSpeed = 15.0;
zapPos.maxForce = 5.0;
curMin = minute();
curHour = hour();
zapPos.setSeekPt(land.marks.get(int(random(land.marks.size()))));
struc.zapPoint(zapPos);
}
void draw(){
noCursor();
background(30,40,90);
if(curMin != minute()){
zapPos.setSeekPt(land.marks.get(int(random(land.marks.size()))));
struc.zapPoint(zapPos);
curMin = minute();
land.changeRule(int(random(5)));
imginc++;
}
if(curHour != hour()){
land.reconfiguring = true;
curHour = hour();
}
world.update();
zapPos.run(gfx);
Vec3D lightPos = struc.interpolateTo(zapPos,0.8);
pointLight(220,180,200,lightPos.x,lightPos.y,lightPos.z);
noStroke();
struc.run(gfx);
land.run(gfx);
v.run();
if(key == 'c'){
println(v.campos, v.direction);
}
}
class Agent3D extends VerletParticle{
Vec3D targ, direction;
TriangleMesh shape;
float maxSpeed, maxForce;
Agent3D(float x, float y, float z){
super(x,y,z);
direction = null;
shape = new TriangleMesh();
targ = null;
maxSpeed = 5.0;
maxForce = 1.2;
}
Agent3D(float x, float y, float z, Vec3D rot){
this(x,y,z);
direction = rot;
}
Agent3D(float x, float y, float z, Vec3D rot, TriangleMesh shape){
this(x,y,z,rot);
this.shape = shape;
}
void setSeekPt(Vec3D target){
targ = target;
}
void setDirectionToFace(Vec3D pt){
direction.set(this.sub(pt).normalize());
}
void seek(){
if(targ != null){
Vec3D c = this.sub(targ);
float m = map(c.magnitude(),0,100,0,maxSpeed);
c = c.normalizeTo(m);
Vec3D steer = this.getVelocity().sub(c);
steer = steer.limit(maxForce);
this.addVelocity(steer);
}
}
void display(ToxiclibsSupport tls){
tls.translate(this);
shape = shape.pointTowards(direction);
tls.mesh((Mesh3D)shape, false);
tls.translate(new Vec3D().sub(this));
}
void run(ToxiclibsSupport tls){
seek();
update();
display(tls);
clearVelocity();
}
}
class SuperStructure extends Agent3D{
int timeOfBirth, age, maxAge, maxBlocks;
Structure[] structs;
SuperStructure(float x, float y, float z, Mesh3D m, Vec3D dir, int lifespan, int blockNum, int blockH, int blockW){
super(x,y,x,dir);
maxBlocks = blockNum;
maxAge = lifespan;
shape = (TriangleMesh)new STLReader().loadBinary(sketchPath("god.stl"),STLReader.TRIANGLEMESH);
structs = new Structure[m.getFaces().size()];
for(int i = 0; i < structs.length; i++){
Face f = (Face)m.getFaces().toArray()[i];
structs[i] = new Structure(this.x,this.y,this.z,this.direction, blockH, maxAge, blockW, blockH, maxBlocks, f);
}
}
void zapPoint(Vec3D pt){
setDirectionToFace(pt);
for(Structure s: structs){
s.setDirectionToFace(pt);
}
}
void run(ToxiclibsSupport tls){
zapPoint(zapPos);
for(Structure s: structs){
if(s != null){
s.grow();
}
}
fill(255);
this.display(tls);
}
}
class Structure extends Agent3D{
float baseRadius, maxBlockWidth, maxBlockHeight, blockWidth, blockHeight;
int timeOfBirth, age, maxAge, maxBlockNum, blockSlot, lifeStage;
Block[] blocks;
Triangle3D base;
Structure(float x, float y, float z, Vec3D dir, float top, int lifespan, float wid, float hei, int blockNum, Face baseMake){
super(x,y,z,dir);
timeOfBirth = frameCount;
maxBlockWidth = wid;
blockSlot = 0;
maxBlockHeight = hei;
maxBlockNum = blockNum;
maxAge = lifespan;
blocks = new Block[maxBlockNum];
base = new Triangle3D((Vec3D)baseMake.a, (Vec3D)baseMake.b, (Vec3D)baseMake.c);
for(int i = 0; i < maxBlockNum; i++){
Vec3D newPoint = base.a.interpolateTo(base.b.interpolateTo(base.c,random(1)),random(1));
blocks[i] = new Block(newPoint.x,newPoint.y,newPoint.z,direction,maxBlockWidth,maxBlockHeight,(int)random(maxAge));
}
}
void setDirectionToFace(Vec3D pt){
direction = pt.sub(this).normalize();
}
Triangle3D buildBase(){
Vec3D[] corners = new Vec3D[3];
for(int i = 0; i < 3; i++){
//creates corners by making flat random vector and then rotating to match structures rotation
Vec3D newCorner = new Vec3D(random(-1,1)*baseRadius,0,random(-1,1)*baseRadius).rotateX(direction.x).rotateY(direction.y);
corners[i] = newCorner;
}
return new Triangle3D(corners[0],corners[1],corners[2]);
}
void grow(){
gfx.translate(this);
for(int i = 0; i < maxBlockNum; i++){
Block b = blocks[i];
b.grow();
b.display(gfx);
if(frameCount-b.birth > b.maxAge){
Vec3D newPoint = base.a.interpolateTo(base.b.interpolateTo(base.c,random(1)),random(1));
blocks[i] = new Block(newPoint.x,newPoint.y,newPoint.z,direction,maxBlockWidth,maxBlockHeight,maxAge);
}
}
gfx.translate(new Vec3D().sub(this));
}
}
class Block extends Agent3D{
float wdth, hght;
int tone, birth, maxAge;
TColor col;
Vec3D up;
Vec3D box;
Block(float x,float y,float z,Vec3D rot, float wt, float ht,int maxAge){
super(x,y,z,rot);
birth = frameCount;
this.maxAge = maxAge;
wdth = wt;
hght = ht;
box = blockFace();
tone = int(noise(frameCount*0.03)*30);
}
Vec3D blockFace(){
return this.add(direction.normalizeTo((frameCount+1-birth)*1.0/maxAge*hght));
}
void grow(){
box = blockFace();
}
void display(ToxiclibsSupport tls){
strokeWeight(wdth);
stroke(180,180,200,tone);
tls.line(this,box);
}
}
class Viewer{
Vec3D direction, campos;
Viewer(float x, float y, float z, Vec3D dir) {
direction = dir;
campos = new Vec3D(x,y,z);
}
void run() {
direction.set(sin(map(mouseX,0,width,2*PI,0)),map(mouseY,0,height,-1.5,1.5),cos(map(mouseX,0,width,2*PI,0)));
direction.addSelf(campos);
// Change height of the camera with mouseY
camera(campos.x, campos.y, campos.z, // eyeX, eyeY, eyeZ
direction.x, direction.y, direction.z, // centerX, centerY, centerZ
0.0, 1.0, 0.0); // upX, upY, upZ
if(keyPressed){
Vec3D dir = direction.copy();
dir.subSelf(campos);
switch(key){
case('a'):
dir.set(sin(map(mouseX,0,width,2.5*PI,PI/2)),0,cos(map(mouseX,0,width,2.5*PI,PI/2)));
campos.addSelf(dir.normalizeTo(3));
break;
case('w'):
campos.addSelf(dir.normalizeTo(3));
break;
case('d'):
dir.set(sin(map(mouseX,0,width,2.5*PI,PI/2)),0,cos(map(mouseX,0,width,2.5*PI,PI/2)));
campos.subSelf(dir.normalizeTo(3));
break;
case('s'):
campos.subSelf(dir.normalizeTo(2));
break;
}
}
}
}
class Land extends Agent3D{
TriangleMesh originalShape;
Terrain terrain;
ArrayList<Agent3D> marks;
int ruleNum;
boolean reconfiguring;
float reconfigRatio;
float xCenter = 5.2;
float zCenter = 5.2;
Land(float xx,float yy,float zz, Vec3D dir){
super(xx,yy,zz,dir);
marks = new ArrayList();
int DIMS = 40;
reconfiguring = false;
reconfigRatio = 0.0;
terrain = new Terrain(DIMS,DIMS, 50);
float[] el = new float[DIMS*DIMS];
noiseSeed((long)random(500));
ruleNum = int(random(5));
for (int z = 0, i = 0; z < DIMS; z++) {
for (int x = 0; x < DIMS; x++) {
el[i++] = noise(x * 0.12, z * 0.12) * 400/PApplet.max((PApplet.abs(xCenter - (x%10))*PApplet.abs(zCenter-(z%10))),4);
if((x+5)%10 == 0 && (z+5)%10 == 0){
IsectData3D sec = new IsectData3D();
sec = terrain.intersectAtPoint(x,z);
marks.add(new Agent3D(sec.pos.x()*50-1000,150,sec.pos.z()*50-1000,new Vec3D()));
}
}
}
terrain.setElevation(el);
// create mesh
shape = (TriangleMesh)terrain.toMesh();
originalShape = shape.copy();
}
void display(ToxiclibsSupport tls){
noStroke();
super.display(tls);
stroke(255,0,0);
}
void run(ToxiclibsSupport tls){
if(reconfiguring) {
reconfigure();
}
super.run(tls);
for(Agent3D mark: marks){
mark.run(tls);
}
alterTerrain(zapPos);
}
ArrayList<Vec3D> getVertexPoints(TriangleMesh s){
ArrayList<Vec3D> start = new ArrayList();
Iterator<Vertex> getter = shape.getVertices().iterator();
while(getter.hasNext()){
start.add((Vec3D)getter.next());
}
return start;
}
ArrayList<Vec3D> getCloseVertices(Vec3D pt){
ArrayList<Vec3D> result = new ArrayList();
Vec3D ptFlat = new Vec3D(pt.x,0,pt.z);
ListIterator<Vec3D> remover = getVertexPoints(shape).listIterator();
while(remover.hasNext()){
Vec3D f = (Vec3D)remover.next();
Vec3D flat = new Vec3D(f.x,0,f.z);
if(flat.distanceToSquared(ptFlat) < 10000){
result.add(f);
}
}
return result;
}
Vec3D average(ArrayList<Vec3D> vecs){
Vec3D result = new Vec3D();
for(Vec3D v: vecs){
result = result.add(v);
}
return result.scale(1.0/vecs.size());
}
void reconfigure(){
shape = originalShape.copy();
reconfiguring = false;
}
void changeRule(int r){
ruleNum = r;
}
void alterTerrain(Agent3D cursor){
for(Agent3D mark: marks){
if(cursor.distanceToSquared(mark) < 4){
ArrayList<Vec3D> nearPts = getCloseVertices(cursor);
for(Vec3D pt: nearPts){
Vec3D rule = new Vec3D();
switch(ruleNum){
case(0):
rule = pt.sub(average(nearPts));
break;
case(1):
rule = average(nearPts).sub(pt);
break;
case(2):
rule = new Vec3D(cos(second()*PI/30),sin(second()*PI/15),sin(second()*PI/30));
break;
case(3):
rule = new Vec3D(pt.sub(struc));
break;
case(4):
rule = new Vec3D(struc.sub(pt));
break;
}
shape.updateVertex(pt, pt.add(rule.normalizeTo(2)));
}
mark.setSeekPt(average(getCloseVertices(cursor)));
}
}
}
}
Hello all, this is a (turns out) rather complicated clock program that I was inspired to create after I saw this a few months ago:
Here is my version, it changes 15 seconds before the turn of the minute.
int radius = 120;
int lineradius=radius/2-3;
int[] cX= new int[24];
int[] cY= new int[24];
float[] time1c1r1= new float[10];
float[] time2c1r1= new float[10];
float[] time1c1r2= new float[10];
float[] time2c1r2= new float[10];
float[] time1c1r3= new float[10];
float[] time2c1r3= new float[10];
float[] time1c2r1= new float[10];
float[] time2c2r1= new float[10];
float[] time1c2r2= new float[10];
float[] time2c2r2= new float[10];
float[] time1c2r3= new float[10];
float[] time2c2r3= new float[10];
int prevSec;
int prevMin;
int millisRolloverTime;
void setup() {
size(1280, 720);
for (int c=0; c<8; c++) {
for (int r=0; r<3; r++) {
int index = c+(8*r);
cX[index]=(width/2)-(radius*4-radius/2)+(radius*c);
cY[index]=(height/2)-radius+(radius*r);
}
}
setTime();
millisRolloverTime=0;
}
void draw() {
background(#ffffff);
fill(0);
rect(width/2-radius/2, height/2-120, radius, radius*2);
fill(#ffffff);
noStroke();
ellipse(width/2, height/2-radius/2, radius/2.68, radius/2.68);
ellipse(width/2, height/2+radius/2, radius/2.68, radius/2.68);
for (int i=0; i<24; i++) {
stroke(0);
strokeWeight(4);
fill(#ffffff);
ellipse(cX[i], cY[i], radius, radius);
strokeWeight(8);
showTimeMove(i);
//showTimeTogether(i);
if (minute()+1==60) {
println("Next min: 00");
} else {
println("Next min: "+(minute()+1));
}
if (hour()+1==24) {
println("Next hr: 00");
} else {
println("Next hr: "+(hour()+1));
}
}
}
float backwards(float num) {
float newnum = num;
if (num==0) {
newnum= 0;
}
if (num==90) {
newnum= 270;
}
if (num==135) {
newnum= 225;
}
if (num==180) {
newnum= 180;
}
if (num==270) {
newnum= 90;
}
return newnum;
}
void showTimeMove(int i) {
if (prevSec != second()) {
millisRolloverTime = millis();
}
prevSec = second();
int mils = millis() - millisRolloverTime;
float test = map(second() + mils/1000.0, 0, 60, 0, 360+(0));
line(width/2, height/2-radius/2, width/2+cos(radians(test))*20, (height/2-radius/2)+(sin(radians(test))*20));
line(width/2, height/2+radius/2, width/2+cos(radians(test))*20, (height/2+radius/2)+(sin(radians(test))*20));
float animate = 0;
int animationTime = 16;
if (second()>=(60-animationTime)) {
animate = (second()- (60-animationTime) + mils/1000.0);
} else {
animate = 0;
}
int start = 135;
int end = 225;
test = -1*map(animate, 0, animationTime, -1*start, 360+end);
//line(radius, radius, radius+cos(radians(test))*lineradius, radius+sin(radians(test))*lineradius);
int digitH1=hour()/10;
int digitH2=hour()%10;
int digitM1=minute()/10;
int digitM2=minute()%10;
float coords;
float digitM1move;
int hour = hour();
int minute = minute();
// FIRST DIGIT
if (i==0) {
if ((hour==9 || hour==19) && minute==59) {
coords = map(animate, 0, animationTime, time1c1r1[digitH1], 1440+(time1c1r1[digitH1+1]));
} else if (hour==23 && minute==59) {
coords = map(animate, 0, animationTime, time1c1r1[digitH1], 1440+(time1c1r1[0]));
} else {
coords = map(animate, 0, animationTime, time1c1r1[digitH1], 1440+(time1c1r1[digitH1]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if ((hour==9 || hour==19) && minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time2c1r1[digitH1], 720+(backwards(time2c1r1[digitH1+1])));
} else if (hour==23 && minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time2c1r1[digitH1], 720+(backwards(time2c1r1[0])));
} else {
coords = -1*map(animate, 0, animationTime, -1*time2c1r1[digitH1], 720+(backwards(time2c1r1[digitH1])));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==1) {
if ((hour==9 || hour==19) && minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time1c2r1[digitH1], 720+(backwards(time1c2r1[digitH1+1])));
} else if (hour==23 && minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time1c2r1[digitH1], 720+(backwards(time1c2r1[0])));
} else {
coords = -1*map(animate, 0, animationTime, -1*time1c2r1[digitH1], 720+(backwards(time1c2r1[digitH1])));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if ((hour==9 || hour==19) && minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time2c2r1[digitH1], 360+(backwards(time2c2r1[digitH1+1])));
} else if (hour==23 && minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time2c2r1[digitH1], 360+(backwards(time2c2r1[0])));
} else {
coords = -1*map(animate, 0, animationTime, -1*time2c2r1[digitH1], 360+(backwards(time2c2r1[digitH1])));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==8) {
if ((hour==9 || hour==19) && minute==59) {
coords = map(animate, 0, animationTime, time1c1r2[digitH1], 360+(time1c1r2[digitH1+1]));
} else if (hour==23 && minute==59) {
coords = map(animate, 0, animationTime, time1c1r2[digitH1], 360+(time1c1r2[0]));
} else {
coords = map(animate, 0, animationTime, time1c1r2[digitH1], 360+(time1c1r2[digitH1]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if ((hour==9 || hour==19) && minute==59) {
coords = map(animate, 0, animationTime, time2c1r2[digitH1], 720+(time2c1r2[digitH1+1]));
} else if (hour==23 && minute==59) {
coords = map(animate, 0, animationTime, time2c1r2[digitH1], 720+(time2c1r2[0]));
} else {
coords = map(animate, 0, animationTime, time2c1r2[digitH1], 720+(time2c1r2[digitH1]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==9) {
if ((hour==9 || hour==19) && minute==59) {
coords = map(animate, 0, animationTime, time1c2r2[digitH1], 720+(time1c2r2[digitH1+1]));
} else if (hour==23 && minute==59) {
coords = map(animate, 0, animationTime, time1c2r2[digitH1], 720+(time1c2r2[0]));
} else {
coords = map(animate, 0, animationTime, time1c2r2[digitH1], 720+(time1c2r2[digitH1]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if ((hour==9 || hour==19) && minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time2c2r2[digitH1], 1080+(backwards(time2c2r2[digitH1+1])));
} else if (hour==23 && minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time2c2r2[digitH1], 1080+(backwards(time2c2r2[0])));
} else {
coords = -1*map(animate, 0, animationTime, -1*time2c2r2[digitH1], 1080+(backwards(time2c2r2[digitH1])));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==16) {
if ((hour==9 || hour==19) && minute==59) {
coords = map(animate, 0, animationTime, time1c1r3[digitH1], 720+(time1c1r3[digitH1+1]));
} else if (hour==23 && minute==59) {
coords = map(animate, 0, animationTime, time1c1r3[digitH1], 720+(time1c1r3[0]));
} else {
coords = map(animate, 0, animationTime, time1c1r3[digitH1], 720+(time1c1r3[digitH1]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if ((hour==9 || hour==19) && minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time2c1r3[digitH1], 720+(backwards(time2c1r3[digitH1+1])));
} else if (hour==23 && minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time2c1r3[digitH1], 720+(backwards(time2c1r3[digitH1+1])));
} else {
coords = -1*map(animate, 0, animationTime, -1*time2c1r3[digitH1], 720+(backwards(time2c1r3[digitH1])));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==17) {
if ((hour==9 || hour==19) && minute==59) {
coords = map(animate, 0, animationTime, time1c2r3[digitH1], 720+(time1c2r3[digitH1+1]));
} else if (hour==23 && minute==59) {
coords = map(animate, 0, animationTime, time1c2r3[digitH1], 720+(time1c2r3[0]));
} else {
coords = map(animate, 0, animationTime, time1c2r3[digitH1], 720+(time1c2r3[digitH1]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if ((hour==9 || hour==19) && minute==59) {
coords = map(animate, 0, animationTime, time2c2r3[digitH1], 1080+(time2c2r3[digitH1+1]));
} else if (hour==23 && minute==59) {
coords = map(animate, 0, animationTime, time2c2r3[digitH1], 1080+(time2c2r3[0]));
} else {
coords = map(animate, 0, animationTime, time2c2r3[digitH1], 1080+(time2c2r3[digitH1]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
// SECOND DIGIT
if (i==2) {
if ((hour!=9 && hour!=19 && hour!=23) && minute==59) {
coords = map(animate, 0, animationTime, time1c1r1[digitH2], 720+(time1c1r1[digitH2+1]));
} else if ((hour==23 || hour==19 || hour==9) && minute==59) {
coords = map(animate, 0, animationTime, time1c1r1[digitH2], 720+(time1c1r1[0]));
} else {
coords = map(animate, 0, animationTime, time1c1r1[digitH2], 720+(time1c1r1[digitH2]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if ((hour!=9 && hour!=19 && hour!=23) && minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time2c1r1[digitH2], 720+(backwards(time2c1r1[digitH2+1])));
} else if ((hour==23 || hour==19 || hour==9) && minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time2c1r1[digitH2], 720+(backwards(time2c1r1[0])));
} else {
coords = -1*map(animate, 0, animationTime, -1*time2c1r1[digitH2], 720+(backwards(time2c1r1[digitH2])));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==3) {
if ((hour!=9 && hour!=19 && hour!=23) && minute==59) {
coords = map(animate, 0, animationTime, time1c2r1[digitH2], 720+(time1c2r1[digitH2+1]));
} else if ((hour==23 || hour==19 || hour==9) && minute==59) {
coords = map(animate, 0, animationTime, time1c2r1[digitH2], 720+(time1c2r1[0]));
} else {
coords = map(animate, 0, animationTime, time1c2r1[digitH2], 720+(time1c2r1[digitH2]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if ((hour!=9 && hour!=19 && hour!=23) && minute==59) {
coords = map(animate, 0, animationTime, time2c2r1[digitH2], 1440+(time2c2r1[digitH2+1]));
} else if ((hour==23 || hour==19 || hour==9) && minute==59) {
coords = map(animate, 0, animationTime, time2c2r1[digitH2], 1440+(time2c2r1[0]));
} else {
coords = map(animate, 0, animationTime, time2c2r1[digitH2], 1440+(time2c2r1[digitH2]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==10) {
if ((hour!=9 && hour!=19 && hour!=23) && minute==59) {
coords = map(animate, 0, animationTime, time1c1r2[digitH2], 720+(time1c1r2[digitH2+1]));
} else if ((hour==23 || hour==19 || hour==9) && minute==59) {
coords = map(animate, 0, animationTime, time1c1r2[digitH2], 720+(time1c1r2[0]));
} else {
coords = map(animate, 0, animationTime, time1c1r2[digitH2], 720+(time1c1r2[digitH2]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if ((hour!=9 && hour!=19 && hour!=23) && minute==59) {
coords = map(animate, 0, animationTime, time2c1r2[digitH2], 360+(time2c1r2[digitH2+1]));
} else if ((hour==23 || hour==19 || hour==9) && minute==59) {
coords = map(animate, 0, animationTime, time2c1r2[digitH2], 360+(time2c1r2[0]));
} else {
coords = map(animate, 0, animationTime, time2c1r2[digitH2], 360+(time2c1r2[digitH2]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==11) {
if ((hour!=9 && hour!=19 && hour!=23) && minute==59) {
coords = map(animate, 0, animationTime, time1c2r2[digitH2], 360+(time1c2r2[digitH2+1]));
} else if ((hour==23 || hour==19 || hour==9) && minute==59) {
coords = map(animate, 0, animationTime, time1c2r2[digitH2], 360+(time1c2r2[0]));
} else {
coords = map(animate, 0, animationTime, time1c2r2[digitH2], 360+(time1c2r2[digitH2]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if ((hour!=9 && hour!=19 && hour!=23) && minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time2c2r2[digitH2], 720+(backwards(time2c2r2[digitH2+1])));
} else if (digitH2==9 && minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time2c2r2[digitH2], 720+(backwards(time2c2r2[0])));
} else {
coords = -1*map(animate, 0, animationTime, -1*time2c2r2[digitH2], 720+(backwards(time2c2r2[digitH2])));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==18) {
if ((hour!=9 && hour!=19 && hour!=23) && minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time1c1r3[digitH2], 720+(backwards(time1c1r3[digitH2+1])));
} else if (digitH2==9 && minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time1c1r3[digitH2], 720+(backwards(time1c1r3[0])));
} else {
coords = -1*map(animate, 0, animationTime, -1*time1c1r3[digitH2], 720+(backwards(time1c1r3[digitH2])));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if ((hour!=9 && hour!=19 && hour!=23) && minute==59) {
coords = map(animate, 0, animationTime, time2c1r3[digitH2], 1080+(time2c1r3[digitH2+1]));
} else if (digitH2==9 && minute==59) {
coords = map(animate, 0, animationTime, time2c1r3[digitH2], 1080+(time2c1r3[0]));
} else {
coords = map(animate, 0, animationTime, time2c1r3[digitH2], 1080+(time2c1r3[digitH2]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==19) {
if ((hour!=9 && hour!=19 && hour!=23) && minute==59) {
coords = map(animate, 0, animationTime, time1c2r3[digitH2], 1080+(time1c2r3[digitH2+1]));
} else if ((hour==23 || hour==19 || hour==9) && minute==59) {
coords = map(animate, 0, animationTime, time1c2r3[digitH2], 1080+(time1c2r3[0]));
} else {
coords = map(animate, 0, animationTime, time1c2r3[digitH2], 1080+(time1c2r3[digitH2]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if ((hour!=9 && hour!=19 && hour!=23) && minute==59) {
coords = map(animate, 0, animationTime, time2c2r3[digitH2], 720+(time2c2r3[digitH2+1]));
} else if ((hour==23 || hour==19 || hour==9) && minute==59) {
coords = map(animate, 0, animationTime, time2c2r3[digitH2], 720+(time2c2r3[0]));
} else {
coords = map(animate, 0, animationTime, time2c2r3[digitH2], 720+(time2c2r3[digitH2]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
// THIRD DIGIT
if (i==4) {
if (digitM1!=5 && digitM2==9) {
coords = map(animate, 0, animationTime, time1c1r1[digitM1], 720+(time1c1r1[digitM1+1]));
} else if (minute==59) {
coords = map(animate, 0, animationTime, time1c1r1[digitM1], 720+(time1c1r1[0]));
} else {
coords = map(animate, 0, animationTime, time1c1r1[digitM1], 720+(time1c1r1[digitM1]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if (digitM1!=5 && digitM2==9) {
coords = -1*map(animate, 0, animationTime, -1*time2c1r1[digitM1], 1080+(backwards(time2c1r1[digitM1+1])));
} else if (minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time2c1r1[digitM1], 1080+(backwards(time2c1r1[0])));
} else {
coords = -1*map(animate, 0, animationTime, -1*time2c1r1[digitM1], 1080+(backwards(time2c1r1[digitM1])));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==5) {
if (digitM1!=5 && digitM2==9) {
coords = map(animate, 0, animationTime, time1c2r1[digitM1], 720+(time1c2r1[digitM1+1]));
} else if (minute==59) {
coords = map(animate, 0, animationTime, time1c2r1[digitM1], 720+(time1c2r1[0]));
} else {
coords = map(animate, 0, animationTime, time1c2r1[digitM1], 720+(time1c2r1[digitM1]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if (digitM1!=5 && digitM2==9) {
coords = map(animate, 0, animationTime, time2c2r1[digitM1], 360+(time2c2r1[digitM1+1]));
} else if (minute==59) {
coords = map(animate, 0, animationTime, time2c2r1[digitM1], 360+(time2c2r1[0]));
} else {
coords = map(animate, 0, animationTime, time2c2r1[digitM1], 360+(time2c2r1[digitM1]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==12) {
if (digitM1!=5 && digitM2==9) {
coords = -1*map(animate, 0, animationTime, -1*time1c1r2[digitM1], 1080+(backwards(time1c1r2[digitM1+1])));
} else if (minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time1c1r2[digitM1], 1080+(backwards(time1c1r2[0])));
} else {
coords = -1*map(animate, 0, animationTime, -1*time1c1r2[digitM1], 1080+(backwards(time1c1r2[digitM1])));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if (digitM1!=5 && digitM2==9) {
coords = -1*map(animate, 0, animationTime, -1*time2c1r2[digitM1], 720+(backwards(time2c1r2[digitM1+1])));
} else if (minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time2c1r2[digitM1], 720+(backwards(time2c1r2[0])));
} else {
coords = -1*map(animate, 0, animationTime, -1*time2c1r2[digitM1], 720+(backwards(time2c1r2[digitM1])));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==13) {
if (digitM1!=5 && digitM2==9) {
coords = -1*map(animate, 0, animationTime, -1*time1c2r2[digitM1], 720+(backwards(time1c2r2[digitM1+1])));
} else if (minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time1c2r2[digitM1], 720+(backwards(time1c2r2[0])));
} else {
coords = -1*map(animate, 0, animationTime, -1*time1c2r2[digitM1], 720+(backwards(time1c2r2[digitM1])));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if (digitM1!=5 && digitM2==9) {
coords = map(animate, 0, animationTime, time2c2r2[digitM1], 720+(time2c2r2[digitM1+1]));
} else if (minute==59) {
coords = map(animate, 0, animationTime, time2c2r2[digitM1], 720+(time2c2r2[0]));
} else {
coords = map(animate, 0, animationTime, time2c2r2[digitM1], 720+(time2c2r2[digitM1]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==20) {
if (digitM1!=5 && digitM2==9) {
coords = -1*map(animate, 0, animationTime, -1*time1c1r3[digitM1], 720+(backwards(time1c1r3[digitM1+1])));
} else if (minute==59) {
coords = -1*map(animate, 0, animationTime, -1*time1c1r3[digitM1], 720+(backwards(time1c1r3[0])));
} else {
coords = -1*map(animate, 0, animationTime, -1*time1c1r3[digitM1], 720+(backwards(time1c1r3[digitM1])));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if (digitM1!=5 && digitM2==9) {
coords = map(animate, 0, animationTime, time2c1r3[digitM1], 1080+(time2c1r3[digitM1+1]));
} else if (minute==59) {
coords = map(animate, 0, animationTime, time2c1r3[digitM1], 1080+(time2c1r3[0]));
} else {
coords = map(animate, 0, animationTime, time2c1r3[digitM1], 1080+(time2c1r3[digitM1]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==21) {
if (digitM1!=5 && digitM2==9) {
coords = map(animate, 0, animationTime, time1c2r3[digitM1], 360+(time1c2r3[digitM1+1]));
} else if (minute==59) {
coords = map(animate, 0, animationTime, time1c2r3[digitM1], 360+(time1c2r3[0]));
} else {
coords = map(animate, 0, animationTime, time1c2r3[digitM1], 360+(time1c2r3[digitM1]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if (digitM1!=5 && digitM2==9) {
coords = map(animate, 0, animationTime, time2c2r3[digitM1], 720+(time2c2r3[digitM1+1]));
} else if (minute==59) {
coords = map(animate, 0, animationTime, time2c2r3[digitM1], 720+(time2c2r3[0]));
} else {
coords = map(animate, 0, animationTime, time2c2r3[digitM1], 720+(time2c2r3[digitM1]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
// FOURTH DIGIT
if (i==6) {
if (digitM2!=9) {
coords = map(animate, 0, animationTime, time1c1r1[digitM2], 1440+(time1c1r1[digitM2+1]));
} else {
coords = map(animate, 0, animationTime, time1c1r1[digitM2], 1440+(time1c1r1[0]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if (digitM2!=9) {
coords = -1*map(animate, 0, animationTime, -1*time2c1r1[digitM2], 720+(backwards(time2c1r1[digitM2+1])));
} else {
coords = -1*map(animate, 0, animationTime, -1*time2c1r1[digitM2], 720+(backwards(time2c1r1[0])));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==7) {
if (digitM2!=9) {
coords = map(animate, 0, animationTime, time1c2r1[digitM2], 720+(time1c2r1[digitM2+1]));
} else {
coords = map(animate, 0, animationTime, time1c2r1[digitM2], 720+(time1c2r1[0]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if (digitM2!=9) {
coords = map(animate, 0, animationTime, time2c2r1[digitM2], 360+(time2c2r1[digitM2+1]));
} else {
coords = map(animate, 0, animationTime, time2c2r1[digitM2], 360+(time2c2r1[0]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==14) {
if (digitM2!=9) {
coords = map(animate, 0, animationTime, time1c1r2[digitM2], 360+(time1c1r2[digitM2+1]));
} else {
coords = map(animate, 0, animationTime, time1c1r2[digitM2], 360+(time1c1r2[0]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if (digitM2!=9) {
coords = map(animate, 0, animationTime, time2c1r2[digitM2], 720+(time2c1r2[digitM2+1]));
} else {
coords = map(animate, 0, animationTime, time2c1r2[digitM2], 720+(time2c1r2[0]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==15) {
if (digitM2!=9) {
coords = -1*map(animate, 0, animationTime, -1*time1c2r2[digitM2], 720+(backwards(time1c2r2[digitM2+1])));
} else {
coords = -1*map(animate, 0, animationTime, -1*time1c2r2[digitM2], 720+(backwards(time1c2r2[0])));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if (digitM2!=9) {
coords = -1*map(animate, 0, animationTime, -1*time2c2r2[digitM2], 360+(backwards(time2c2r2[digitM2+1])));
} else {
coords = -1*map(animate, 0, animationTime, -1*time2c2r2[digitM2], 360+(backwards(time2c2r2[0])));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==22) {
if (digitM2!=9) {
coords = -1*map(animate, 0, animationTime, -1*time1c1r3[digitM2], 360+(backwards(time1c1r3[digitM2+1])));
} else {
coords = -1*map(animate, 0, animationTime, -1*time1c1r3[digitM2], 360+(time1c1r3[0]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if (digitM2!=9) {
coords = map(animate, 0, animationTime, time2c1r3[digitM2], 720+(time2c1r3[digitM2+1]));
} else {
coords = map(animate, 0, animationTime, time2c1r3[digitM2], 720+(time2c1r3[0]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
if (i==23) {
if (digitM2!=9) {
coords = map(animate, 0, animationTime, time1c2r3[digitM2], 1080+(time1c2r3[digitM2+1]));
} else {
coords = map(animate, 0, animationTime, time1c2r3[digitM2], 1080+(time1c2r3[0]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
if (digitM2!=9) {
coords = map(animate, 0, animationTime, time2c2r3[digitM2], 360+(time2c2r3[digitM2+1]));
} else {
coords = map(animate, 0, animationTime, time2c2r3[digitM2], 360+(time2c2r3[0]));
}
line(cX[i], cY[i], cX[i]+cos(radians(coords))*lineradius, cY[i]+sin(radians(coords))*lineradius);
}
}
void setTime() {
int d;
d=0;//SET TIME = 0
time1c1r1[d] = 0;
time2c1r1[d] = 90;
time1c1r2[d] = 270;
time2c1r2[d] = 90;
time1c1r3[d] = 270;
time2c1r3[d] = 0;
time1c2r1[d] = 180;
time2c2r1[d] = 90;
time1c2r2[d] = 270;
time2c2r2[d] = 90;
time1c2r3[d] = 270;
time2c2r3[d] = 180;
d=1;//SET TIME = 1
time1c1r1[d] = 135;
time2c1r1[d] = 135;
time1c1r2[d] = 135;
time2c1r2[d] = 135;
time1c1r3[d] = 135;
time2c1r3[d] = 135;
time1c2r1[d] = 90;
time2c2r1[d] = 90;
time1c2r2[d] = 270;
time2c2r2[d] = 90;
time1c2r3[d] = 270;
time2c2r3[d] = 270;
d=2;//SET TIME = 2
time1c1r1[d] = 0;
time2c1r1[d] = 0;
time1c1r2[d] = 0;
time2c1r2[d] = 90;
time1c1r3[d] = 270;
time2c1r3[d] = 0;
time1c2r1[d] = 180;
time2c2r1[d] = 90;
time1c2r2[d] = 270;
time2c2r2[d] = 180;
time1c2r3[d] = 180;
time2c2r3[d] = 180;
d=3;//SET TIME = 3
time1c1r1[d] = 0;
time2c1r1[d] = 0;
time1c1r2[d] = 0;
time2c1r2[d] = 0;
time1c1r3[d] = 0;
time2c1r3[d] = 0;
time1c2r1[d] = 180;
time2c2r1[d] = 90;
time1c2r2[d] = 270;
time2c2r2[d] = 180;
time1c2r3[d] = 270;
time2c2r3[d] = 180;
d=4;//SET TIME = 4
time1c1r1[d] = 90;
time2c1r1[d] = 90;
time1c1r2[d] = 270;
time2c1r2[d] = 0;
time1c1r3[d] = 135;
time2c1r3[d] = 135;
time1c2r1[d] = 90;
time2c2r1[d] = 90;
time1c2r2[d] = 270;
time2c2r2[d] = 90;
time1c2r3[d] = 270;
time2c2r3[d] = 270;
d=5;//SET TIME = 5
time1c1r1[d] = 0;
time2c1r1[d] = 90;
time1c1r2[d] = 270;
time2c1r2[d] = 0;
time1c1r3[d] = 0;
time2c1r3[d] = 0;
time1c2r1[d] = 180;
time2c2r1[d] = 180;
time1c2r2[d] = 180;
time2c2r2[d] = 90;
time1c2r3[d] = 270;
time2c2r3[d] = 180;
d=6;//SET TIME = 6
time1c1r1[d] = 0;
time2c1r1[d] = 90;
time1c1r2[d] = 270;
time2c1r2[d] = 90;
time1c1r3[d] = 270;
time2c1r3[d] = 0;
time1c2r1[d] = 180;
time2c2r1[d] = 180;
time1c2r2[d] = 180;
time2c2r2[d] = 90;
time1c2r3[d] = 270;
time2c2r3[d] = 180;
d=7;//SET TIME = 7
time1c1r1[d] = 0;
time2c1r1[d] = 0;
time1c1r2[d] = 135;
time2c1r2[d] = 135;
time1c1r3[d] = 135;
time2c1r3[d] = 135;
time1c2r1[d] = 180;
time2c2r1[d] = 90;
time1c2r2[d] = 270;
time2c2r2[d] = 90;
time1c2r3[d] = 270;
time2c2r3[d] = 270;
d=8;//SET TIME = 8
time1c1r1[d] = 0;
time2c1r1[d] = 90;
time1c1r2[d] = 270;
time2c1r2[d] = 0;
time1c1r3[d] = 270;
time2c1r3[d] = 0;
time1c2r1[d] = 180;
time2c2r1[d] = 90;
time1c2r2[d] = 270;
time2c2r2[d] = 180;
time1c2r3[d] = 270;
time2c2r3[d] = 180;
d=9;//SET TIME = 9
time1c1r1[d] = 0;
time2c1r1[d] = 90;
time1c1r2[d] = 270;
time2c1r2[d] = 0;
time1c1r3[d] = 135;
time2c1r3[d] = 135;
time1c2r1[d] = 180;
time2c2r1[d] = 90;
time1c2r2[d] = 270;
time2c2r2[d] = 90;
time1c2r3[d] = 270;
time2c2r3[d] = 270;
}
void showTimeTogether(int i) {
int digit=second()%10;
//SET TIME BY ROW AND COLUMN
if (i%2!=0) {
if (i<8) {
line(cX[i], cY[i], cX[i]+cos(radians(time1c2r1[digit]))*lineradius, cY[i]+sin(radians(time1c2r1[digit]))*lineradius);
line(cX[i], cY[i], cX[i]+cos(radians(time2c2r1[digit]))*lineradius, cY[i]+sin(radians(time2c2r1[digit]))*lineradius);
} else if (i>=8 && i<16) {
line(cX[i], cY[i], cX[i]+cos(radians(time1c2r2[digit]))*lineradius, cY[i]+sin(radians(time1c2r2[digit]))*lineradius);
line(cX[i], cY[i], cX[i]+cos(radians(time2c2r2[digit]))*lineradius, cY[i]+sin(radians(time2c2r2[digit]))*lineradius);
} else {
line(cX[i], cY[i], cX[i]+cos(radians(time1c2r3[digit]))*lineradius, cY[i]+sin(radians(time1c2r3[digit]))*lineradius);
line(cX[i], cY[i], cX[i]+cos(radians(time2c2r3[digit]))*lineradius, cY[i]+sin(radians(time2c2r3[digit]))*lineradius);
}
} else {
if (i<8) {
line(cX[i], cY[i], cX[i]+cos(radians(time1c1r1[digit]))*lineradius, cY[i]+sin(radians(time1c1r1[digit]))*lineradius);
line(cX[i], cY[i], cX[i]+cos(radians(time2c1r1[digit]))*lineradius, cY[i]+sin(radians(time2c1r1[digit]))*lineradius);
} else if (i>=8 && i<16) {
line(cX[i], cY[i], cX[i]+cos(radians(time1c1r2[digit]))*lineradius, cY[i]+sin(radians(time1c1r2[digit]))*lineradius);
line(cX[i], cY[i], cX[i]+cos(radians(time2c1r2[digit]))*lineradius, cY[i]+sin(radians(time2c1r2[digit]))*lineradius);
} else {
line(cX[i], cY[i], cX[i]+cos(radians(time1c1r3[digit]))*lineradius, cY[i]+sin(radians(time1c1r3[digit]))*lineradius);
line(cX[i], cY[i], cX[i]+cos(radians(time2c1r3[digit]))*lineradius, cY[i]+sin(radians(time2c1r3[digit]))*lineradius);
}
}
}
This morning I, realized I had been spending way too much money. I began to relate my spending habits with the days of the week and realized that tracking the amount of money I had spent would be a perfect way for me to tell how far along into the week we are. Originally I aimed to make this in java processing, but python was much more receptive to the list structure I wanted to use, so I switched to python mode.
Here is a snapshot of September 24th at 4:44
And here is a snapshot of today, October 1st at 4:45
sun = []
mon = [10.56, 9.10, 19.68, 5.62, 7.39]
tue = [7.27, 6.75, 8.85, 7.39]
wed = [7.39, 7.39, 2.85]
thu = [2.00, 6.75, 13.75]
fri = [6.75, 9.08, 9.08]
sat = [7.27, 6.75, 8.85, 7.39]
sunTot = 0
monTot = 0
tueTot = 0
wedTot = 0
thuTot = 0
friTot = 0
satTot = 0
sunAvg = 0
monAvg = 0
tueAvg = 0
wedAvg = 0
thuAvg = 0
friAvg = 0
satAvg = 0
weekTot = 0
weekAvg = 0
sunLoss = 0
monLoss = 0
tueLoss = 0
wedLoss = 0
thuLoss = 0
friLoss = 0
satLoss = 0
lossList = []
todayTotal = 0
lossPerSecond = 0
dayLoss = 0
previousDayLoss = 0
startingCash = 0
totalLoss = 0
currentCash = 0
def setup():
size(800,300)
startingCash = 240 #Dollars
initialize()
previousDayLoss = cashUsed()
def initialize():
sunTot = total(sun)
monTot = total(mon)
tueTot = total(tue)
wedTot = total(wed)
thuTot = total(thu)
friTot = total(fri)
satTot = total(sat)
weekList = [sunTot, monTot, tueTot, wedTot, thuTot, friTot, satTot]
weekTot = total(weekList)
sunAvg = sunTot / weekTot
monAvg = monTot / weekTot
tueAvg = tueTot / weekTot
wedAvg = wedTot / weekTot
thuAvg = thuTot / weekTot
friAvg = friTot / weekTot
satAvg = satTot / weekTot
weekAvg = weekTot / 7.0
sunLoss = sunAvg * startingCash
monLoss = monAvg * startingCash
tueLoss = tueAvg * startingCash
wedLoss = wedAvg * startingCash
thuLoss = thuAvg * startingCash
friLoss = friAvg * startingCash
satLoss = satAvg * startingCash
lossList = [sunLoss, monLoss, tueLoss, wedLoss, thuLoss, friLoss, satLoss]
todayTotal = lossList[dayOfWeek()]
lossPerSecond = todayTotal / 86400
def draw():
background(findBg())
dayLoss = ((((hour() * 60) + minute()) * 60) + second()) * lossPerSecond
totalLoss = previousDayLoss + dayLoss
currentCash = startingCash - totalLoss
printCash()
def total(alist):
total = 0
for i in alist:
total += i
return total
def dayOfWeek():
# 5 is number of days into 2014 for sunday
daystotal = (365*(year() - 1)) + (int(floor((year()-1)/4))) -(int(floor((year() - 1)/100))) + (int(floor((year() - 1)/400))) + day()
return daystotal % 7
def week():
return month() * 4 + day() % 7
def cashUsed():
w = week()
d = dayOfWeek()
daysElapsed = (w % 2) * 7 + d - 1
loss = 0
for i in range(daysElapsed):
loss += lossList[i%7] / 2
return loss
def findBg():
return map(255.0 * ((((week() % 2) * 7) + dayOfWeek()) / 14.0),255,0,0,255) \
+ map(hour()+8,24,0,0,18)
def printCash():
textAlign(CENTER)
cashLeft = "%f" % currentCash
fill(100)
textSize(width * .20)
lost = nfs(totalLoss,3,2)
text("$"+lost,width*.505, height*.71)
fill(255,0,0)
stroke(0)
textSize(width * .20)
lost = nfs(totalLoss,3,2)
text("$"+lost,width*.5, height*.7)
My personal clock utilized layered rectangles traveling across two bars at the top of the screen. As a minute goes by, the bars will meet in the middle and continue across the screen in a wave-like motion. The minutes of the hour are represented by a lighter rectangle that moves across each bar in a similar fashion. The hour is not specifically shown. However, the lamp will be displayed lighter in the daytime and darker as nighttime approaches.
//Will Taylor
//EMS clock
float tintR = 100;
float tintG = 100;
float tintB = 100;
void setup(){
PImage bg = loadImage("bridgeLight.jpg");
size(bg.width, bg.height);
drawClock();
frameRate(20);
smooth();
}
void draw(){
float s = second();
float m = minute();
float h = hour();
float sec = map(s,0,59, 0,width);
float sec2 = map(s,0,59, width,0);
float min = map(m,0,59, 0,width);
float min2 = map(m,0,59, width,0);
//drawClock();
float alphaS = 2;
float alphaM = 1;
//noStroke();
// MINUTES //
if (s%2 == 0) {
fill(#C2BCDB, alphaM);
} else {
fill(#FF05C5, alphaM);
}
rect(min, width/13 + 5, width/30, 50);
rect(min, width/23 + 5, width/30,50);
rect(min2, width/7 + 5, width/30, 50);
rect(min2, width/6 + 14, width/30,50);
// SECONDS //
if (s%2 == 0) {
fill(#FC08D4, alphaS);
} else {
fill(#08C9FC, alphaS);
}
if (s >=30){
alphaS = 6;
println(alphaS);
}
float secX = 0; float secY = width/13;
rect(sec, width/13 + 5, width/30, 50);
rect(sec, width/23 + 5, width/30,50);
rect(sec2, width/13 + 5, width/30, 50);
rect(sec2, width/23 + 5, width/30,50);
if (s%2 == 0) {
fill(#08C9FC, alphaS);
} else {
fill(#FC08D4, alphaS);
}
rect(sec, width/7 + 5, width/30, 50);
rect(sec, width/6 + 14, width/30,50);
rect(sec2, width/7 + 5, width/30, 50);
rect(sec2, width/6 + 14, width/30,50);
if (second()== 0){
drawClock();
}
}
void drawClock() {
float h = hour();
float alpha = 40;
float hour = 24 - h;
float opacity = 0; //controls darkness of lamp
float hourAlpha = (255/24) * hour ;
if (hour() < 12){ // gets brighter from midnight to noon
opacity = hourAlpha;
} else {
opacity = 255 - hourAlpha; // gets darker from noon to midnight
}
PImage bg = loadImage("bridgeLight.jpg");
float m = minute();
float min = map(m,0,59,0,width);
image(bg,0,0);
fill(0, opacity);
println(hour());
println(hour, "*");
println(hourAlpha);
rect(0,width/3, width, height);
fill(0, 150);
rect(0, width/23, width,100); //second bar
rect(0, width/7, width,100); //min bar
}
A screen shot taken around midday.
The work day in Amsterdam’s Red Light District runs from about 7pm till 3am. This is a sped-up render of a visual clock representing that work period across the world. The image consists of 24 bars, that can be turning on, on or off. Each bar represents a time zone, and there is a small cross on the bar that shares the time zone of the clock (in this case the US east coast). It’s intended as a reminder of what is currently happening across the world, either near or far, and the stories of the people involved. This is a rendering of the change across time sped up:
code:
//The Whoring Hours. This might belong in a sports bar.
// function that handles the drawing of the light. Could be kept
// within the bar class
void drawBar( int sx, int sy, int ex, int ey, float dx,
color lowC, color highC){
int lr = int(red(lowC));
int lg = int(green(lowC));
int lb = int(blue(lowC));
int dr = int(red(highC)) - lr;
int dg = int(green(highC)) - lg;
int db = int(blue(highC)) - lb;
stroke(lr,lg,lb, int(100*dx));
strokeWeight(40);
line(sx,sy,ex,ey);
stroke(lr + dr/3,lg + dg/3,lb + db/3, int(150*dx));
strokeWeight(20);
line(sx,sy,ex,ey);
stroke(lr + int(dx*2*dr/3),lg + int(dx*2*dg/3),
lb + int(dx*2*db/3),int(200*dx));
strokeWeight(7);
line(sx,sy,ex,ey);
stroke(lr + int(dr*dx*dx),lg + int(dg*dx*dx),
lb + int(db*dx*dx),int(255*dx*dx));
strokeWeight(2);
line(sx,sy,ex,ey);
fill(0);
noStroke();
rect(sx-20,sy-40,40,40);
rect(ex-20,ey,40,40);
}
//class for each of the light bars that represent a time zone
class Light {
String name;
int diff;
int sStart;
int hStart;
int sEnd;
int hEnd;
int x;
int y;
//int alpha;
//int r;
float dl;
Light( String tempName, int tempDiff, int tempSS, int tempHS,
int tempSE, int tempHE, int tempX, int tempY){
name = tempName;
diff = tempDiff;
sStart = tempSS;
hStart = tempHS;
sEnd = tempSE;
hEnd = tempHE;
x = tempX;
y = tempY;
dl = 0.0;
}
//gets the relative brightness (dh) based on time of day and
//time difference
void update(int h, float dh){
int nh = (h + diff) % 24;
if ((nh >= hEnd) && (nh < sStart)){
dl = 0.0;
}
else if (nh >= hStart || nh < sEnd){
dl = 1.0;
}
else if (nh == sStart){
dl = dh;
}
else {
dl = 1-dh;
}
}
void display(){
drawBar( x,y,x,y+200, dl, color(255,0,0),color(255,255,255));
textAlign(CENTER);
fill(160,190,190);
text(name,x,y+220);
}
}
ArrayList<Light> lights;
void setup(){
size(1200,300);
lights = new ArrayList<Light>();
for( int i = -4; i<20; i ++){
lights.add(new Light("", i, 19,20, 2,3, (i+5)*width/25,50));
}
}
void draw(){
int s = second();
int m = minute();
int h = hour();
float dh = float(m)/60 + float(s)/(60*60);
background(10);
for (int i = lights.size()-1; i >= 0; i--) {
Light light = lights.get(i);
light.update(h,dh);
light.display();
}
fill(200,200,200);
textAlign(LEFT);
textSize(15);
text("The Whoring Hours:",15,30);
stroke(200,200,200);
strokeWeight(1);
line((5*width/25)-5,270,(5*width/25)+5,270);
line((5*width/25),265,(5*width/25),275);
}