Page 1 of 1

Scale a rectangle in only one direction

Posted: Wed Nov 16, 2016 4:45 pm
by pazeller
Hi!

I am a noobie and I would like to know how I can create a rectangle which scales vertically (Y) but only in one direction. This works, but my rectangle is scaling in both directions (up and down). I would like to achieve the scaling only towards the up direction. Is this possible? how?
Any clue is welcome :)

Vincent

Re: Scale a rectangle in only one direction

Posted: Wed Nov 16, 2016 5:00 pm
by Magic
Yup, it's fairly simple actually. You just have to translate by the same amount you're scaling. Like this:
ScaleAndTranslate.png
ScaleAndTranslate.png (21.61 KiB) Viewed 9597 times

Re: Scale a rectangle in only one direction

Posted: Thu Nov 17, 2016 1:58 pm
by pazeller
Ok. Thats what I was thinking about...

From my small experiment, the rectangle is moving a bit (probably because there are small delays)... is there a better solution to avoid this?

Thank you!

Vincent

Re: Scale a rectangle in only one direction

Posted: Thu Nov 17, 2016 3:50 pm
by Magic
Well, there are many different ways you could do it. You could draw a black rectangle on the bottom half of the image, or you could use the Mask module to mask the bottom half, etc.

Also, in Magic 2.0 there will be a new feature which eliminates the small delays you noticed :).

Re: Scale a rectangle in only one direction

Posted: Thu Nov 17, 2016 4:21 pm
by artnik
From experience, the easiest way to achieve this consistently is to translate the rectangle by half its size, such that the edge of it is effectively resting on it's origin point. I.e.translate it first to place an edge in the middle of the screen.

The order of operations is: 1. Translate. 2. Scale based on input. 3. Do other scaling and translating as needed.

Cheers!

Re: Scale a rectangle in only one direction

Posted: Thu Nov 17, 2016 4:28 pm
by Magic
Ah yes, that's probably the best :). Sometimes I forget the obvious things. What would I do without you guys :). I must be getting old.

Re: Scale a rectangle in only one direction

Posted: Thu Nov 17, 2016 4:36 pm
by artnik
We're all getting old Eric! ☺

Re: Scale a rectangle in only one direction

Posted: Wed Nov 30, 2016 3:16 pm
by pazeller
Thanks all for the help ;-)