Chapter 43: Basics of Animation

Slide Deck

How do we animate?

Modifying scene parameters as a function of time.

Scripting

Specifiying the parameters at every frame.

define spinningCube()
  rotAngle = pi*frameNumber / 50
define carScript()
   carTranslation = 10*(frameNumber / 100)
   wheelRotation  = pi*frameNumber / 5

Hierarchical Modeling

This is the order you typically apply rotations:

Why?

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).

Here’s the (simplified) javascript code for the above example.

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

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.


Outline

  1. Forward Kinematics/Key framing
  2. Inverse Kinematics
  3. Motion capture
  4. Simulation
  5. Behavioral Animation
  6. Physically based (Dynamics)