change of size after scale

edited October 2013 in How To...

Hi,

I am a bit confused...what happens to the object when I call scale? I expected the size of that object to be changed, but e.g. in case of RiTa http://rednoise.org/rita/ library, after scaleTo function, the width of the text stays the same. But I can see the change if I get the size in the callback function and only there.

Now - is this RitaTExt specific behavior? Am I misunderstanding the whole scale concept ? in order to get the changes to the object elsewhere..do i need to manually change...the font of the text in the callback? :/ Feeling that I am doing smth wrong....

THanks for support!

Nune

Tagged:

Answers

  • edited October 2013 Answer ✓

    Here I draw the same object twice (except the first time I draw it it is red, and the second time I draw it, it is green). The only difference is that I call scale in between drawing the two objects. This scales the positioning system used to place and size objects by some factor.

    size(220,220);
    background(0);
    noStroke();
    fill(255,0,0);
    rect(10,10,100,100);
    scale(.6);
    fill(0,255,0);
    rect(10,10,100,100);
    

    If you understand why this sketch gives the output it does, then you understand the scale() function correctly.

  • ok, thanks! got it i guess :) the scale() scales the space and not a particular object.

  • resize() can also do the trick.

Sign In or Register to comment.