// Simple uv.x animation
const { texture, uniform, vec2, vec4, uv, oscSine, timerLocal, grayscale } = THREE;
//const samplerTexture = new THREE.Texture();
const samplerTexture = new THREE.TextureLoader().load( './textures/uv_grid_opengl.jpg' );
samplerTexture.wrapS = THREE.RepeatWrapping;
//samplerTexture.wrapT = THREE.RepeatWrapping;
//samplerTexture.colorSpace = THREE.SRGBColorSpace;
const timer = timerLocal( .5 ); // .5 is speed
const uv0 = uv();
const animateUv = vec2( uv0.x.add( oscSine( timer ) ), uv0.y );
// label is optional
const myMap = texture( samplerTexture, animateUv ).rgb.label( 'myTexture' );
const myColor = uniform( new THREE.Color( 0x0066ff ) ).label( 'myColor' );
const opacity = .7;
const desaturatedMap = grayscale( myMap.rgb );
const finalColor = desaturatedMap.add( myColor );
output = vec4( finalColor, opacity );