Lecture 11: Introduction to Animation
How do we animate?
Modifying scene parameters as a function of time.
Specifiying the parameters at every frame.
define spinningCube() rotAngle = pi*frameNumber / 50
define carScript() carTranslation = 10*(frameNumber / 100) wheelRotation = pi*frameNumber / 5
This is the order you typically apply rotations:
- Non-uniform scale will mess up rotations
- Translation will mess up everything
In a hierarchical model, generally do T and R, then
push() for S, draw, and
pop() before continuing on.
Unless your models are positioned with the origin at where you want it to pivot, you typically also need to do a translate after the rotate but before the scale (because translates mess up everything).
push(); // upper-arm rectangle (red) rotate(upperArmRotation); drawAnchor(); push(); translate(100, 0); drawRect(200, 100); // box pop(); push(); // lower-arm rectangle (green) translate(200, 0); rotate(lowerArmRotation); drawAnchor(); push(); translate(100, 0); drawRect(200, 80); // box pop(); push(); // hand rectangle (blue) translate(200, 0); rotate(handRotation); drawAnchor(); push(); translate(75, 0); drawRect(150, 60); // box pop(); pop(); pop(); pop();
The boxes we draw are centered at the origin, so we need to translate out the width to get the pivots/anchors we want.
Key-framing means defining specific animation frames and interpolating between them to get frame-by-frame animation poses. Typically an artist creates the keyframes.
But how do we interpolate the poses? Can we just use linear interpolation?
For poses and and , which goes from 0 for pose 0 and to 1 for pose 1.
- For positions? Absolutely?
- Scales? Yes.
- Rotations? Nope.
- Forward Kinematics/Key framing
- Inverse Kinematics
- Motion capture
- Behavioral Animation
- Physically based (Dynamics)
- Key framing
- Euler angles
- Inverse kinematics
- Motion capture
- Collision detection
- Spatial data structures
- Principles of animation
- Squash and stretch
- Timing and motion
- Follow through
- Ease in/out