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 › How do you resize objects
Page Index Toggle Pages: 1
How do you resize objects? (Read 222 times)
How do you resize objects?
Jan 17th, 2009, 10:40pm
 
Im trying to make a design that has a line that is constantly being resized, but I can't seem to figure out how to make the line shrink/expand.  Anybody know how to resize objects?
Re: How do you resize objects?
Reply #1 - Jan 17th, 2009, 11:49pm
 
There are not "objects" in Processing, although you can define your own (or use some in libraries). Unless you mean SVG shapes...

To your point, if you have a line, it is defined by two points, ie. 2 x/y coordinates. Vary the coordinates, you have a variable size line.
Re: How do you resize objects?
Reply #2 - Jan 22nd, 2009, 12:23pm
 
Indeed it is best to relocate your points and update the line. At this moment I am busy with a project that had the same problem, and as far as I know it is best to adjust the pointlocation. You could also probably scale the line, but I think this is more difficult to control correctly.

IE: you have p1 and p2, with line(p1.x, p1.y, p2.x, p2.y).
Now you want to extend the line. Assuming you keep p1 at the same position you have to relocate p2 (p2.x += differenceX, p2.y += difference Y) and update the line by using the new p2 coordinates
Page Index Toggle Pages: 1