我想渐渐消失,然后从左向右渐渐渐渐进入image.a / image.alpha,然后每秒渐渐退回

时间:2019-11-19 09:22:05

标签: glsl shader fragment-shader vertex-shader unity3d-shaders

我有一个徽标.png image = uImage,并在其上面贴有箔膜uColor。如何使用变量uTime和图像每秒淡出和淡入图像?

export const fragmentShader = `
 uniform float uTime;
 uniform float uColorSpeed;
 uniform float uColorStretch;
 uniform float uSwipeSpeed;
 uniform float uSwipeSize;
 uniform float uOpacity;
 uniform float uFrequency;
 uniform float uOpacityAll;
 uniform sampler2D uColor;
 uniform sampler2D uImage;
 uniform vec2 uSpriteSheetPosition;
 uniform float uSpriteSheetColumns;
 uniform float uSpriteSheetRows;
 varying vec2 vUv;

 void main() {
 float newTime =  mod(uTime, 100.0);
 vec4 color = texture2D(uColor, vec2((vUv.x - 1.0) * (newTime * 0.1), vUv.x));
 vec4 image = texture2D(uImage,vec2(vUv.xy));
 vec3 foilColor = vec3(color);  
 gl_FragColor = vec4(foilColor, image.a - 0.5);
}`;

0 个答案:

没有答案