11 Replies Latest reply on Dec 7, 2015 4:24 PM by tish1776

# Make a square into a rectangle

Hi!

Beginner here. I'm trying to animate a square so that it stretches to the right into a rectangle while maintaining the stroke of the shape. If I scale by increasing the x-axis, it throws off the stroke completely. If I resize it, then it maintains the stroke, but resizes by stretching out both the left and right sides of the square simultaneously, and I just want one side of the square to seemingly stretch to the right into a rectangle. Is there a simple way to do this? Thanks!

• ###### 1. Re: Make a square into a rectangle

You will want to use a shape layer and animate the size of the rectangle instead of using scale. Scale effects all properties, the size of a shape layer does not change the width of the stroke.

• ###### 2. Re: Make a square into a rectangle

Hi,

Yes, but is there away to do that so that the square only elongates from one side? By going and resizing, both sides of the square elongates together. I'm trying animate a square such that one side of the square stretches out into a rectangle. Thank you!

• ###### 3. Re: Make a square into a rectangle

I don't know of way to do it with a shape but you could use solid with a mask and a stroke effect than just animate the mask path.    I've heard a few pro's say that they prefer to work with masked solids rather than shapes whenever they can as you just have alot more control..

• ###### 4. Re: Make a square into a rectangle

I sorta figured it out. You can't do it using the square/rectangle tool, you have to draw a square free hand with the pen tool. Then you go to Shape/Path/ (set a key frame), then select the side of the square and you can drag it out without distorting the stroke of the shape. The thing is, drawing a perfect square or rectangle by hand using the pen tool is a lot harder than it should be. I can't get it to snap to the grid lines (if that's even possible) so that I draw straight lines. Any suggestions?

• ###### 5. Re: Make a square into a rectangle

You can do it that way...just enable snapping with the little icon to right of all the cursor icons.  Or you could do it with the mask like I said because you can draw out a perect square mask with the shift key just like with a shape.  Just create a solid the color you want the fill then with the layer slected draw out the square mask.  Then apply the stroke effect from the effects panel...just type it into the search field to find it.  Finally key the mask path property to drag out the side of the mask just like you did with the hand drawn shape.

If you're really unfamiliar with using masks maybe search for a tutorial on Youtube or in the AE help.

• ###### 6. Re: Make a square into a rectangle

Sorry...to snap to grid you enable "Snap To Grid" in the View Menu. Alot of times the first point you draw will not snap so you need to back and snap it to the grid after the shape is drawn

• ###### 7. Re: Make a square into a rectangle

Thanks for your help Gutter-Fish. I'm looking up some youtube tutorials now on masks, i know a little about them, but I guess not enough hahaha

• ###### 8. Re: Make a square into a rectangle

Here is a step-by-step:

1. Make sure no layers are selected
2. Double-click the rectangle shaped tool to create a new rectangle the size of your composition
3. Select the new shape layer
4. Press the U key twice  to reveal all the modified properties of the shape layer including Zoe rectangle size
5. Click the little infinity shaped icon to unlock the X and Y  values for the rectangle
6. Type in the new values for your rectangle like 500 x 900
7. Activate the stopwatch to set your first keyframe
8. Move down the timeline to a new position and change the 900 to 500
That is all there is to it. This is a very basic AE skill you should have in your toolbox.
• ###### 9. Re: Make a square into a rectangle

Rick i don't see anything in you instructions that would achieve what they're trying to do (I don't think.).

Adjusting the the size property, as far as know scales the rectangle from the center (even when the anchor point is somewhere else).

They want one side of the rectangle to remain stationary while the other side stretches out.

The only way to achieve this without effecting the stroke (as far as I know) is by animating the path itself.

So as far as I can see the only options are to create the shape with the pen tool as they already figured out.

Or to use a mask with a stroke effect.

But maybe I am missing something in your instructions?

• ###### 10. Re: Make a square into a rectangle

If you want to move from a corner or an edge then you also animate the anchor point. This can easily be done with an expression added to the Rectangle Anchor Point property (not the layer Anchor Point). To lock the top left corner of the rectangle in position as you change the size the expression is:

- content("Rectangle 1").content("Rectangle Path 1").size/2

If you don't want to mess with the expression then as you animate the size of the rectangle just animate half the size value for the Rectangle Anchor Point. I use this technique all the time to create animated bar graphs and charts. A more sophisticated way to write the expression allow you do tie any corner of the rectangle to the anchor point. For bottom left it looks like this:

p = content("Rectangle 1").content("Rectangle Path 1").size/2;

[-p[0], p[1]]

We have simply defined the array and used the - sign to move the x value to the left side while the y value moves to the bottom. This makes numerically accurate animations very easy to do.

If you want to do this kind of animation quickly by eye you could also right click on Rectangle 1 (assuming it's the first rectangle in the shape layer) and convert the rectangle to a bezier path then simply use the pen tool or the transform path tool to do your animations. A shape layer will always give you more options and freedom than a mask on a solid with the stroke effect.

Here's a little video I just threw together:

• ###### 11. Re: Make a square into a rectangle

Very informative video Rick! And I have a feeling others will benefit from it too, thanks so much for doing this!