When the rendering of your animation is wrong
When the rendering of your animation is wrong you will notice a jump in the animation on the first frame. By default, the library tries to match the most logical positioning of the first frame but sometimes it doesn't match what you need, and in that case, you'll want to use the immediaterender property. In this lecture, we will understand how and when to use the immediaterender property.
Video Transcript
00:00So there might be a scenario, and I'm just going to comment our current tween out,
00:04there might be a scenario where you want to create an animation, but you want to pause it.
00:10And by default, when you go, for example, and I'm just going to create your tween light
00:15from, and I'm going to take from and I'm going to take our target, our MC logo,
00:21and I'm going to start from and the duration, I want it to be three seconds,
00:24um, you know, I'll do two seconds and I want, um, to position first.
00:28I want my scale X to be at a dot eight and my scale Y to be at dot eight.
00:36Basically say it basically that my animation should pop in or grow in.
00:43All right. So that's the animation that I was intending to do.
00:46But what if I added here a delay and really what I want in this delay of one second or even,
00:52I'm going to put here a nice long delay of three seconds.
00:56I don't want my logo to be smaller.
00:58I want it to start from big and then plop that plop down suddenly and grow back in.
01:04So if I wanted to do that, I have a problem because what's actually happening when I'm
01:09using the from it's automatically setting the visuals on the first frame, even before,
01:14even though we have a delay to prevent this default behavior.
01:18What I could do is set the immediate render mode to be false.
01:26Now, just to be, just to understand how this works by default,
01:31the two function, it's immediate render is false by default because by default,
01:36the next frame is going to start animating it.
01:39Contrary to that with the from function, from method by default,
01:44it's going to take you to the first frame of that animation
01:47immediately or the from basically.
01:51And that is because it's expected that if you want to go from position A to position B,
01:55that the first thing you want to do is get to position A
01:58and not be in position B on your first frame.
02:01But in my case, I really do want to be in position B in the first frame.
02:04And that way I'm first in the where I'm at.
02:07And then suddenly there is animation that happens.
02:10And obviously this isn't very dramatic, but if I would change the animation style
02:14a little bit and maybe set it to be that the animation will take
02:17just zero to four seconds, and I'll put a delay of maybe zero four as well.
02:22What's going to happen is it's going to be a shock value of some sort.
02:26It's going to force my eyes into that position.
02:29And as long as I could create an animation that is subtle enough
02:32and interesting enough, then this pulse is going to be very natural.
02:35Obviously, when I put long delays, long delays won't look good.
02:39But in this scenario, you don't even feel that there's a jump.
02:41And in many ways, I would even do it faster and maybe even a smaller,
02:46a smaller jump or play around with the values, both of the X scale
02:50and of the amount of time of the animation to try to find that right
02:53configuration to make it most realistic.
02:56And these types of tweaks make it really easy for us to catch the user's eye
03:01if we want to move the user's eye to a specific spot.
03:04And if we do it clean enough, then the user won't even notice that there was a jump.
03:08He's just going to feel like something dramatic just happened there.
03:11And his eye will gravitate to wherever that element,
03:14wherever that motion just happened.
03:17All right.
03:17So that's immediate render.
03:19And it's really mainly relevant when you're doing a from animation,
03:23because with the two animation, there really isn't a lot of reason
03:27for you to set it to be true.
03:28But in the case of from, you might have a scenario where you really
03:31want to put yourself in the you don't want to change it automatically
03:35and push it automatically.
03:36And by the way, it could be a scenario, for example,
03:39that if the user interacts with it, then a different animation happens.
03:42So you want by default to be in the position where you're at.
03:44And maybe if the user rolls over, you want to do something else.
03:47And you don't want to be already starting in the end position.
03:50You want to be in the end position.
03:51So it relates just a matter of finesse and the specific scenario with your animation.
03:57All right.
03:57So that covers that element.
03:59And the next thing that we're going to talk about in the next lesson,
04:04we're going to talk about how do you know when an animation is complete
04:07so you could start doing something else.
04:09So we're going to see that immediately in the next session.
