But there, remember how we saw this motion? We're using the change in position to kind of give context to the user. We probably should do the same over here. So let me check out to that. I'm going to stash this again. Check out to pre-final.
So, all right, there we go. That's a lot of motion. I'm going to reload. So, what I'm trying to do here is, do you see these replies? These replies kind of come out of this post. And that gives you the feeling that they're part of the post. And then they stem out from it with a delay.
So, the code for this looks like, I have an initial y of minus 40. And this y of minus 40 converts to a transform animation with a translate y, which is a good thing to animate because it's more performant. And when you go from minus 40, which means its final position, so frame of motion calculates its final position, then goes minus 40 and animates it to that point. So I'm doing minus 40 to y of 0. And I also have a height auto animation, which is cool.
And so when you open this post, the comments come out of the post. It's coming from the direction of a post, which gives you this feeling that these two are related content. So, the post comes first. And then the comments come out of it. Now, check out what happens when I add a new comment. So, if I do nothing, then it will also come from the top, like the other replies. But that doesn't make a lot of sense because, I mean, why is it coming out of the other replies? So what I've done instead is, let me show you what that would look like if I don't do anything.
So when I add a new comment, it comes from the previous comment, which doesn't make sense. So what I do instead is put a plus 20 on it and try to make it look like it's coming from the reply, the input box. So here we go. New Comment, and you see this gets shifted down and the new comment takes its place. I'm going to show it to you. Sorry, let me reload and show it to you again. New reply.
Comments