Hi !!
Video down below.
So, i succeeded to animate the width mesh by increase scale.x, but as you can see the texture is ‘following’ the mesh width. I am struggling to having final sizes texture while scale.x mesh is increasing.
If you have a solution, I’m interested !
Yes, there are solutions. Just modify the offset
and repeat
properties of the texture. In this way you can control what part of the texture is used. Like this:
1 Like
Thanks for your answer !!
But i find an other way to do the animation.
void main() {
vec4 texture = texture2D(tMap, vUv);
float alpha = step(vUv.x, threshold);
gl_FragColor = vec4(texture.rgb, alpha * texture.a);
}
I just have to animate ’ threshold ’ here , and it works like a charm !
I’m glad that you found a solution to your problem. In case you want to do it without shaders, and by just using one line, my solution was:
object.material.map.repeat.x = k;
where k
is the proportion of the box shown (from 0 to 1).
I will try this too, thanks !