Dynamic Rotation and Scale: Rolling a ball to reveal template text | Edaqa Mortoray | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Dynamic Rotation and Scale: Rolling a ball to reveal template text

teacher avatar Edaqa Mortoray, Programmer, Chef, Writer

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

6 Lessons (18m)
    • 1. Introduction

    • 2. Recall Setup From Previous Class

    • 3. Link Ball Position

    • 4. Link Ball Scale to Text

    • 5. Base Rotation on Position and Size

    • 6. Conclusion

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class

Create a rolling ball that reveals text as goes, using Adobe After Effects expressions.

In this class, I'll add a rolling ball to the animation we did in the previous class. You'll learn how to use expressions to get locations relative to a text, calculate sizes, and do some basic math. These are handy techniques when it comes to creating responsive templates.

I'll go through these steps in the process:

  • Positioning the ball to reveal the text
  • Sizing the ball to the text
  • Calculating the ball rotation for a realistic roll

Follow me, as I'll continue to publish classes building on these skills.

Also, if you're like me, you're getting a bit lost with all those assets, clips, and folders, check out my friend Sonja's class on being efficient in After Effects.

Meet Your Teacher

Teacher Profile Image

Edaqa Mortoray

Programmer, Chef, Writer


Hi, I'm Edaqa, a programmer, writer and chef.

For over 20 years, I've been following a diverse and exciting career path. My journey traces through several countries, filled with great people and culture. I've dedicated my time to numerous startups, and an abundance of side projects.

There's so much I'd like to share with all with you -- from programming to cooking, to the unusual creative endeavours.

I want my classes to give you the confidence you need to succeed, and the curiosity required to make the most of life.

Join me in my continuing adventures.

Recently I wrote a book "What is Programming", a dive into the fascinating profession.

I've also taken up the mantle of food stylist, as I started Edaqa's Kitchen last year. Perhaps soon ... See full profile

Class Ratings

Expectations Met?
  • Exceeded!
  • Yes
  • Somewhat
  • Not really
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. Introduction: I. I'm an animation and graphics programmer, and I'm having fun with adobe after effects expressions. I not be emotion graft designer, but I do know code, and I want to show you all sorts of cool things you can do with expressions. This class extends on the text revealing we didn't last. We're gonna add a ball rolling over the text. It may not sound like much, but there are some tricky parts to it. You'll see how toe reuse that dummy animation from before and how to get the ball rolling across the screen correctly. There is a bit more Mathis time, but I'll explain all the bits as we go. You should be able to use this in your own projects. All right, let's get started. 2. Recall Setup From Previous Class: third class gonna start where I left off in the previous class. And there we have three objects. We have the title text. We have a hidden emasculated reveal and we have the dummy shape with reveal. These have to be linked up. Check out the other class to see how you set that up. But quickly camp this object, that dummy object it has the animation and text is just a text layer. It has the name, title text and the dummy layer. That dummy mask has a scale expression saying how to scale it to the dummy and the text and will be working with scale in this class. So if you just have these three objects set up, you should be fine. Otherwise, look to my previous class and how to set this up and understand that various bits 3. Link Ball Position: Okay, so the first thing we're gonna do is we're gonna pull in a bowl that we want to rule. In this case, I'm using a then symbol, the yin Yang, because I want to see it rolls he One object for the ruling is obvious. If you just have a normal ball, you might not see it says willing dog. It's goingto justice down the size all shows leader will actually a justice size dynamically to the text. Let's make it about the size of text. The anchor point in the middle of correct. And we want to put this over The start of the text of the middle should be started the line of the text. And so now we have the position, and that position is fairly static right now, change the name of this layer to be the image or whatever name you changing them to be image so we can refer to it easier than that file name. What I want to do now is I want to make the position dynamic. Will do that by creating an expression for the position. So go ahead and create the position expression and I'm gonna copy and paste it in and then explain the parts of it. So the first thing we need to do is we need to know the width off this image and I'm at the intimate and the with the images. So this layer again referring this layers source, wrecked at times euro with this is what we saw with the text components and the mass component How you get at the source size of this. Now I'm adding something additionally your called transformed scale. Because this source record turns the size of the original image, it does not consider the scale at all. So I'm gonna multiply by this a transformed scale. And I'm only doing zero because it just the wit they care about right now and then dividing it by 100. Remember, divide by 100. Because aftereffects exposes scale as a percentage in the expressions. It isn't Erin that but you have to deal with it. Next is I want the with the text and I should call this text with instead. And this is our title text this calm player get the title text source corrected times who want the width and dot with I do not use scale here because we do not apply scaling to the title text. But you could apply scaling to, in which case you would need to have the transform scales. Well. Previously, when we did the dummy mask, we added patting to the with the text. Now I'm adding the image with and you know it's the ball is right past the end of the text and this is important for the text. If I take off this image width the ball stuck on the end of the text because it will move correctly from the beginning to the end of the text. But that's not far enough. We need the ball to go beyond the end of the text and since we have it center line, we can add the image with times two and that will move up to the end of it. And because we have is a little thing, I don't need to use any padding like we did with the mask. Now I'm going to bind the dummy layer on the object. That's the object up here and I'm going to get its current scale and getting and divide by 100 so we have the current scale that we should be. Where along our path should we be? This will be a value between zero and one now a normalized path. And now we only want to modify our position. We have hand positioned this object somewhere on the screen at the beginning, off the text and want to push it off to the right. So I'm going to take the transformed opposition, the current value of our transform, where it would normally be, and put it at zero, just the X coordinate. And then we're gonna take the text with multiplied by the current scale. So current Skelton's text with to figure out how far along the animation we are then transformed position one, which is the current why location, which we do not want to change. And altogether, this moves the ball along the text to the end. Now what's important to do here is because we took this image with here is we actually have to modify the mascots well, so if you look at the mask, we want the mass to align with the ball. We want the mass to go to the center of the ball, and it doesn't do that right now because it has the wrong wit that doesn't consider it with . So we have to modify the width of the mask to account for the size of the image. Now I'm going to refer to the size off the image. So I add the code to get the image with at the top. And since I'm going to refer to the layer a few times, I going to do it here. I'm gonna refer to images being this comp layer image. And then the image wind is the same code we had before. Except explosive refer to image rather than this layer. I grab it's with and grab it transform and a divide 100 to normalize it. Then we have the text with we have our with. And instead of padding, I'm going to make a new variable, and I'm going to call it a target with this is how Why do we want to be And this will be the text with plus the image with divided by two, that will be the target with that we want instead of using padding, I'm just gonna see target with divided by our Winton. So we changed it from a patting approach to having a target with approach. Now and now we see the Masco submit to the center. We have a bit of a patting issue because it's a little bit off. And so now if I do this, I may want to move this slightly over to the front to write to the middle, and that'll line to the start of the text as well. Now it's now a seed expands along with the ball to the right location. And you know what? I'm a little bit often starts, so we have to make sure it's online just a little bit. We don't have to be as picky with the padding before because we have this whole half with the ball at the end, so we can put a little bit to the left and not worry about missing pixels at the end. So now I have the mask expanding to include the size of the text and half the with the ball , and I have evolved following the position. These are both linked to the dummy option they have above, so if I modified the animation of that, both of them would change. We can see that by taking the scale here, and you can watch the animation adjust toothy key friends that we have for the dummy object in both the reveal and the ball modify at the same time. 4. Link Ball Scale to Text: all right. So we have the bowl following the position of the text following the animation. But we have a bit of a problem. The size of the bowl is not dynamic. So if I change the size of the text, the ball does not change size. It still will animate along with it. But it won't have the right size. It's now. I want to see how we can make the ball respond to the size off the text. We do this by modifying this scale off the image. So on this scale, instead of this stick scale, I use an expression all paste in the expression I have and then explain the parts of it. We start by grabbing a text layer this calm player title text as usual, sign of the text layer. And we want to know the height of the text. And we use the source directed time, height. This gives us the height of the text. This is what we're interested now, a little bit fuzzy. But what hide actually means though. And then we have image height. This is the height up this layer of the actual ball image. And this is the height of the actual file. So if this was like 600 pixels high, this will be 600. It doesn't matter what this height is here. We're going to adapt for it. And now extra scale extra scale means well. I don't want exactly the size of text that one a bit bigger than it is. The extra skill says, Well, let's add a bit more height to it. We'll make it a bit larger than actually required, so it makes it look like it's covering more of the text. And then we ought to figure out the scale. How much do we have to scale the ball from its original size to the size off the text? When we do this with the text, Height divided my image, height and times extra scales and one of the little bit extra big. We wanted a little bit bigger, and that is always multiplied by 100 to convert into percentages. That's aftereffects once, but now we have a ball that's slightly larger. You see, if I change this extra scale toe one, it'll be a bit smaller that we want to make it a bit larger. Make it 1.4 and you're gonna have to fudge it a little bit, too. You find exact size that you want. Unfortunately, now we have the ball matching the height of the text. So if I take the text height, if I take the text and modify its size, the bowl also changes size. We got a bit of an alignment issue and would have toe line that a bit later. But as you make it bigger, it lines up. So now we have the right size off a ball for the text. 5. Base Rotation on Position and Size: way, have the ball the right size and adjusted the text and going over to it. We want to add that last little bit of flair. We wanna have the bowl rotate, and we want the rotation speed toe logically match exploitation across the screen, which means considering the circumference off the ball. I always dislike it when animations have things rotating that don't line up with the actual distance they should be covering. So for this, we're gonna have to add an expression to the rotation. It's all paste, the value of rotation. They didn't explain what it means. Notes. The ball rotates slightly to adjust. So what we need to news. You need to calculate circumference to cover the distance we're gonna take the image with, and they have to refer to the scale. This times it's this layers tours directed time, the whip to the natural with the bowl times its scale, because we've adjusted the scale in an expression before and they divided by 100 because scale was represented as a percent. So now we have the image with now the circumference of the circle. Using a bit of mouth is the value of pi times the image with this is the distance around the edge of the circle. Now we have to convert this into an expression of rotation in one whole rotation expresses 360 degrees is also unfortunate that the chairs degrees is the poster radiance. It doesn't make a difference here, but you'll see that in later examples that it does. So what we want to do is take the position across the screen how far it should have traveled and divided by the Sir Comfort that tells us how often the ball has to have ruled to make it that far. So transform position zero where we are divided by circumference and then times 3 60 because after effects represents rotation as degrees, it's now we have those bits combined, and if we run the animation, you could see the ball rolling along with speed. It should out, so it matches the speed off the animation curve. Because this is all dynamic, we can adjust the actual text, make the text much longer. We'll set the text and as the ball moves faster now to cover more ground, you'll see it actually speeds up as the position goes faster it'll go a lot faster to cover more ground cause rotations based on the actual distance. And if I make it quite short, you see the ball moves slowly the whole time because it does not have much distance to cover. This is done with the rotation expression to take the image. With that calculate this conference and the distance traveled and converted into rotation. And it's based on the images scale, which is based on the flawed sized text. And all of this is linked. The position and the reveal mask to the dummy animation at the top, which controls our an emission, are revealed speed, and we see that here the scale modify the animation curve. Everything modifies at the same time based on that curve too fast role in slow ease out or we could do it the other way. Have a really slow move in the in the middle. We have it speed up and go down, and this is one of the values up using a dummy object and tie it over, that is, you can adjust. You can still use to create frame facility off doobie aftereffects on all the individual expressions are relatively easy. In this example, someone do involve a bit of mouth. All include the code in the project, notes 6. Conclusion: way have it. We have a ball which rotates to review all the text, which adjusts, or the size of the text, which it just for the animation curb of the dummy object and adjust to the size of the images well, and it rotates at the correct speed. There's a lot of little things attached together here. There's not a lot of scripts involved, but I'll put them all in this show. Newt should understand that work. Have yourself example. There's still a bit of alignment. Issues that you'll have to work out in aftereffects get lined up perfectly. But all the basics are there, and this works to show you several techniques of how to do dynamic reveals and to tie things dynamically to user input. A text. This is very valuable for a template and for responsive animations, export the projects you've done to see what you've done with example on how you might have worked up with it to the project so we can all see what you've done. And if you have questions, feel free to ask. I hope you enjoy the class. Please check out my other one to be sure to follow me until next time. Have fun animating