纯色闪烁版本,自定义颜色透明度,高度,位置等。
企鹅 🐧 3448829451
const vertexShader = `
uniform vec3 u_color;
uniform float time;
uniform float u_height;
varying float v_opacity;
void main() {
vec3 vPosition = position;
v_opacity = mix(1.0, 0.0, position.y / u_height * 0.1) * (1.0 + sin(time) * 0.7);
gl_Position = projectionMatrix * modelViewMatrix * vec4(vPosition, 1);
}`;
const fragmentShader = `
uniform vec3 u_color;
uniform float u_opacity;
varying float v_opacity;
void main() {
gl_FragColor = vec4(u_color, v_opacity * u_opacity);
}`;