• fullscreen
  • MicheliEx3Due5_25.pde
  • //Declare and initialize two global arrays and one variable that will be used to
    //hold the array index:
    int[] xpos = new int [1];
    int[] ypos = new int[1];
    int startIndex = 0;
    //Initialize the screen 
    void setup() { 
      background (255,0,0);
      stroke (0);
    //Make a draw() loop that does nothing because drawing is only done when the mouse is clicked. 
    void draw() {
    // nothing happening in draw // since drawing is triggered by the mouse
    //When mouse is pressed draw a line to it.
    //Append array so that an infinite number of lines can be drawn.
    void mousePressed () {
      xpos = (int[]) append (xpos, mouseX);
      ypos = (int[]) append (ypos, mouseY);
      line (xpos[startIndex -1], ypos [startIndex -1], xpos[startIndex], ypos[startIndex]); 


    tweaks (0)

    about this sketch

    This sketch is running as Java applet, exported from Processing.



    Report Sketch

    Report for inappropriate content

    Please provide details if possible:

    Your have successfully reported the sketch. Thank you very much for helping to keep OpenProcessing clean and tidy :)

    Make a Copyright Infringement claim

    Mark Micheli


    Add to Faves Me Likey@!
    You must login/register to add this sketch to your favorites.

    Draw continuous lines from mouse click to mouse click.

    You need to login/register to comment.