GLSL shader on a .png logo with swipe effect from left to right. I

寵の児 提交于 2019-12-24 18:33:18

问题


I am junior developer attempting to create a swipe effect from left to right. Where the logo disappears/gets erased from left to right and then appears from right to left. I've new to GLSL and have never programmed in C++. All my attempts have created varying results. The current result is that the logo it self gets compressed from left to right. So I would be very thankful if someone could give some advice as to code examples that have a similar effect or explain what i'm doing wrong here.

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, 22.0);
  vec4 color = texture2D(uColor, vec2((vUv.x - 1.0) * (newTime * 0.2), vUv.y));
  vec4 image = texture2D(uImage,vec2(vUv));
 vec3 foilColor = vec3(color);  
  gl_FragColor = vec4(foilColor, image.a);
}`;

来源:https://stackoverflow.com/questions/58862928/glsl-shader-on-a-png-logo-with-swipe-effect-from-left-to-right-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!