We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › live drawing of rectangle on drag
Page Index Toggle Pages: 1
live drawing of rectangle on drag (Read 958 times)
live drawing of rectangle on drag
Dec 27th, 2009, 8:33pm
 
I'm trying to draw a rectangle AS the mouse is being dragged. I can get it to draw after the drag --- but not WHILE the mouse is being dragged. I'm a bit new to Processing and am thinking this has something to do with pushing things to a matrix? Thanks for your help.
Re: live drawing of rectangle on drag
Reply #1 - Dec 27th, 2009, 8:44pm
 
it would help if you post what you have done so far. so we can give some advices how to change your code.
Re: live drawing of rectangle on drag
Reply #2 - Dec 27th, 2009, 9:08pm
 
Here is the pertinent part. It works-- but draws a series of rectangles -- not one progressively:
Code:


void draw(){

 onOff=false;

 if ((keyPressed) && (key=='s')){
   onOff=true;
   moveX=mouseX;
   moveY=mouseY;
   
   
    noFill();
 
   stroke(grayLine);
   rect(click.x, click.y, moveX-click.x, moveY-click.y);

 
 }


Page Index Toggle Pages: 1