with save() function you save/push the context setting to the stack and with the restore() function you get/pop the last setting from the stack.
If you want to animate object on the canvas there is an animation loop:
- Clear the canvas
2. Draw the object
3. Move the object
All the code