Just like with the ChestScript, we need some more variables to track how long the animation should go, how long it has gone so far, and where the object started.
- Add the
animationTime
variable, which should be public so that we can change it later. You can set it to 0, or pick a more logical number of seconds for your animation to last, like 2 or 3. - Create a private variable for
elapsedTime
that starts out at 0. - Create another
Euler
variable forstartingRotation