Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import codeanticode.syphon.*; // import the Syphon library
- SyphonServer server; // create the Syphon server object itself
- PGraphics canvas; // create a PGraphics object "canvas" - this will be what the syphon server sends
- PFont helvetica; // create a font object
- void settings() {
- size (1050,160,P2D); // Set the processing window to size, using the 2D renderer
- PJOGL.profile=1; // OpenGL Profile 1
- }
- // The setup function gets executed once: when the sketch first starts
- void setup() {
- canvas = createGraphics(width, height,P2D); // Initialise the syphon server's canvas to the same size as the processing window
- frameRate(30); // Set 30fps (Processing default is 60)
- helvetica = createFont ("Helvetica", 200); // Set the font object to 200pt Helvetica
- server = new SyphonServer(this, "countdown"); // Start the Syphon server
- }
- // The draw function gets executed once every frame (in our case 30 times a second)
- void draw() {
- canvas.beginDraw(); // begin drawing on the Syphon canvas
- canvas.background(0,0,0,0); // Set the background of the Syphon canvas to black with full transparency (R,G,B,A);
- canvas.textFont(helvetica); // Set the font to our Helvetica object
- canvas.text (nf(23-hour(), 2)+":"+nf(59-minute(), 2)+":"+nf(59-second(), 2)+"."+nf(int(1000-System.currentTimeMillis()%1000), 3).substring(0, 2), 0, 150);
- canvas.endDraw(); // finished drawing
- background(0,0,0,0); // Set the background of the processing sketch to black with full transparency
- image(canvas,0,0); // draw the Syphon canvas to the Processing window so we can see it
- server.sendImage(canvas); // Send the frame to the Syphon server
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement