Back to index

Interpolation

Exercises

  1. Make the top vertex of the triangle (gl_VertexID 2) move between point p0 at (-1.0, 1.0, 0.0) and p1 at (1.0, -0.3, 0.0).
  2. Animate the color of the triangle by changing the color output in the fragment shader. Have it interpolate between two colors c0 and c1.
  3. Spend a few minutes and trying different combinations of animations: different vertex ID, other colors, maybe throw in an extra point to interpolate with and use nested mix functions.

Vertices / Uniforms

Vertices:
time:

Vertex shader

Fragment shader