Created
June 6, 2018 12:36
-
-
Save marcedwards/4973523b98e0c30d10351b58e96596a5 to your computer and use it in GitHub Desktop.
Processing source code for a counter that displays seconds and 100ths of a second.
This file contains 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
// A counter that displays seconds and 100ths of a second. | |
// By @marcedwards from @bjango. | |
// | |
// You’ll need to use Tools › Create Font to convert a font file to a Processing .vlw file. | |
// Created using Processing 3.3.7. | |
PFont font; | |
float time = 0; | |
void draw() { | |
background(0); | |
fill(255); | |
time = float(frameCount) / 30; | |
text(nf(time, 2, 1), 10, 50); | |
//render(400); | |
} | |
void setup() { | |
size(200, 100, P2D); | |
frameRate(30); | |
smooth(8); | |
font = loadFont("Lato-Semibold-48.vlw"); | |
textFont(font, 48); | |
textAlign(LEFT); | |
} | |
// Render the animation to PNGs in foldername, then exit. | |
// | |
// The number of frames and path are optional. | |
// Do not include a trailing / in the folder name. | |
void render(int frames, String foldername) { | |
saveFrame(foldername+"/frame####.png"); | |
if (frameCount==frames) { | |
exit(); | |
} | |
} | |
void render(int frames) { | |
render(frames, "render"); | |
} | |
void render(String foldername) { | |
render(100, foldername); | |
} | |
void render() { | |
render(100, "render"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment