Radial Shutter Animation - Built-in functions - Shader Learning

Built-in functions

Radial Shutter Animation

Task

You are provided with two texture slides. Write a GLSL program that switches textures using a radial shutter animation. Use sine or cosine to loop the animation, the total switching time is 2PI seconds.


Radial shutter should work with any aspect ratio.


The iTime uniform provides the current time in seconds.

Theory

To fit a rectangle into a circle, the diagonal of the rectangle must be equal to the diameter of the circle (two radii).



If you have the dimensions of the rectangle's sides w and h, the radius of the circle R can be found by the Pythagorean theorem.