Skip to content
Snippets Groups Projects
grid8x8_dot.pde 681 B
Newer Older
  • Learn to ignore specific revisions
  • OPC opc;
    PImage dot;
    
    void setup()
    {
      size(640, 360);
    
      // Load a sample image
      dot = loadImage("dot.png");
    
      // Connect to the local instance of fcserver
      opc = new OPC(this, "127.0.0.1", 7890);
    
      // Map an 8x8 grid of LEDs to the center of the window
      opc.ledGrid8x8(0, width/2, height/2, height / 12.0, 0, false);
    
      // Make the LED grid visible on-screen. By default, the LED sampling locations
      // are hidden and don't affect Processing's output.
      opc.showLocations(true);
    }
    
    void draw()
    {
      background(0);
    
      // Draw the image, centered at the mouse location
      float dotSize = height * 0.7;
      image(dot, mouseX - dotSize/2, mouseY - dotSize/2, dotSize, dotSize);
    }