This time we are going to bring a wave undulation animation based on HTML5 Canvas, this time it is a glacier wave undulation animation, draw the shape of glacier effect on Canvas and then use the animation feature to make these glaciers keep undulating.
Advertisement
#ifdef GL_ES
precision highp float;
#endif
attribute float displacement;
uniform float amplitude;
uniform float tick;
varying vec3 vNormal;
void main()
{
float amplitudes = cos(position[0] + tick / 500.0) *
cos(position[1] + tick / 500.0) +
amplitude;
vec3 newPosition = position +
normal *
vec3(amplitudes * displacement / 2.0);
vNormal = newPosition;
gl_Position = projectionMatrix *
modelViewMatrix *
vec4(newPosition,1.0);
}
Advertisement