Referring back to context action in version four of the game. Notice how we're adding tweens, tweens, an array of potential tweens in the game, a tween takes a variety of parameters. The first one is the target. So it's going to be in this instance, the target is left position. So the left door position. The second parameter is the channel.
So it's left position, Zed, then it takes the end value. So it's going to be the current left positions at minus 240. So it's going to move nearly two and a half meters left. Then the duration in seconds, so it's going to be two seconds. And then what happens once it comes to the end of the tween. In this instance, there's a function defined that removes this particular tween.
From our tweens array, there is a option for an additional parameter, which is the easy method. And if you look through the various easing methods, you'll see that there are a variety of them in our means it's going to go start slow and ramp up, and then at the end is going to decelerate to a stop. And it's used good you're going to use a quadratic function to do that. The second tween which is moving the ride door has a more complicated end function on complete function. It still has to remove itself from the tweens array, but it also deletes the camera target that means that the camera comes back to the default camera and stops showing the cutscene camera. It finds the particular door that we're dealing with.
And on that basis finds the left and right doors and the Left, left and right proxies and it sets the proxy position to the position of the left and right doors. So the ray caster is no longer blocked. Because the proxies are now and meshed inside the door. You may have noticed already there in the animate function. There is a method based on the tweens. So for each tween, we call update passing in the Delta time that's elapsed.
So that's all you really need to know about tweens. They take a target a channel and then position, a duration and an on complete function. But if you want to look at the source for them easing is is in the in the game JavaScript file. And you can see all the different options you've got for easy bounces, etc. And there's your tween class very simple. Just takes these parameters and assigns them and then has a simple update function, which uses the easing class to decide on on its position based on the current time.
Very useful tweens to animate properties over time with some nice easy