2D Rotation Matrix
14 / 15
📝 Exercise Goal
Rotate coordinates using a 2D rotation matrix.
💡 💡 Tutorial Content
Rotate coordinates using a 2D rotation matrix.
Overview
- Follow the steps to complete the exercise.
Learning Objectives
- Build mat2 rotation
- Apply rotation to shapes
Prerequisites
- uv-coordinates
- time-pulse
Inputs
float u_time— Time in seconds.
Key Concepts
vUvis normalized UV in[0,1].
vec2 uv = vUv;
- Animate with
u_time+sin/cos.
float pulse = sin(u_time) * 0.5 + 0.5;
- Blend values with
mix(a, b, t).
vec3 color = mix(colorA, colorB, t);
- Build a soft mask with
smoothstep.
float m = 1.0 - smoothstep(r, r + aa, d);
How To Implement (Step-by-step)
- Start from vUv.
- Build a soft mask with smoothstep().
- Use mix() to blend outputs.
- Animate with u_time (optional).
Self-check
- Does it compile without errors?
- Does the output match the goal?
- Are key values kept in
[0,1]?
Common Mistakes
- Clamp
tinto[0,1]when needed. - Make sure
edge0 < edge1for smoothstep().