Initializing 3D Canvas...

Animation Principles

2 min read1 page

Easing functions specify the rate of change of a parameter over time. Linear interpolation (LERP) moves at a constant speed, whereas quadratic and cubic curves add natural acceleration and deceleration.

Interpolation Functions:

1. Linear (LERP): Constant velocity. Feels mechanical. 2. Quadratic (Ease In/Out): Smooth start or end. Simulates basic gravity and friction. 3. Cubic (Ease In-Out): Slow start, fast middle, slow end. Perfect for smooth transition transitions.
python
1def lerp(a, b, t):
2 return a + t * (b - a)
3
4def ease_in_quad(t):
5 return t * t
6
7def ease_out_quad(t):
8 return t * (2 - t)
9
10def ease_in_out_cubic(t):
11 if t < 0.5:
12 return 4 * t * t * t
13 else:
14 return 1 - ((-2 * t + 2) ** 3) / 2
Easing Curve Type
2 min read1 page

Skeletal rigging links a continuous geometric mesh (the skin) to a hierarchical structure of joints (the skeleton). Linear Blend Skinning (LBS) deforms vertices by blending transformation matrices from multiple bones using vertex weights.

Skinning Controls:

1. Bones Hierarchy: The elbow position is child to the shoulder joint; rotating the shoulder rotates the entire arm. 2. Vertex Weights: Vertices near the elbow joint are assigned split weights (e.g. 50% shoulder, 50% elbow) to create a smooth deformation bend. 3. Bind Pose Inverse: Vertices are first transformed into the local coordinate system of their respective bones before deformation.
python
1def linear_blend_skinning(v, bones, weights):
2 # LBS formula: v_prime = sum( w_i * M_i * v_local )
3 prime = Vector3(0, 0, 0)
4 for i, bone in enumerate(bones):
5 weight = weights[v.id][i]
6 if weight > 0:
7 # Transform vertex by bone's current matrix
8 local_pos = bone.bind_pose_inverse * v.position
9 world_pos = bone.current_transform * local_pos
10 prime += weight * world_pos
11 return prime
Shoulder Rotation (deg)
0.00
Elbow Rotation (deg)
0.00
3 min read1 page

In 3D animation, objects transition between discrete coordinates called keyframes. While translations are interpolated linearly, interpolating rotations using Euler angles causes distortion and Gimbal Lock. Spherical Linear Interpolation (SLERP) on Quaternions resolves this by finding the shortest arc path.

Euler vs SLERP:

1. Euler Angle Lerp: Animates coordinates independently. Rotations can freeze, spin weirdly, or take long paths. 2. Quaternion SLERP: Represents rotation as an axis-angle unit sphere. Rotates smoothly with constant velocity. 3. Sg-Linear Path: Translations blend linearly alongside rotations to trace a natural motion curve.
python
1def slerp(q0, q1, t):
2 # Spherical Linear Interpolation between two quaternions
3 cos_theta = q0.w * q1.w + q0.x * q1.x + q0.y * q1.y + q0.z * q1.z
4
5 # If dot product is negative, reverse one quaternion to take shortest path
6 if cos_theta < 0.0:
7 q1 = -q1
8 cos_theta = -cos_theta
9
10 if cos_theta > 0.9995:
11 # Linear approximation for close rotations
12 return normalize((1 - t) * q0 + t * q1)
13
14 theta = acos(cos_theta)
15 sin_theta = sin(theta)
16 w0 = sin((1 - t) * theta) / sin_theta
17 w1 = sin(t * theta) / sin_theta
18 return w0 * q0 + w1 * q1
Keyframe Blend (t)
0.00