Creating an oscillating texture animation

image

Let’s say I have the above texture (assume the white area is actually transparent). I want to get the black line to oscillate up and down.

I would like to avoid using keyframes because this will be happening a lot and in many places at the same time.

I would like to be able to achieve this with nodes (and frame-driven). I’m already able to get it to move down based on the frame number but I have no idea how to get it to move back up in the other direction.

image

What I currently have will cause the texture animation to loop (when it reaches the bottom, it’ll automatically start at the top again) which is not what I want.

I’m guessing it’s only looping because you’re using a repeating texture since the math doesn’t do any looping…

If you want it to loop just use a wrap or sine math node. (or even better, a ping-pong as suggested by @AlphaChannel )

Good luck.

2 Likes

Hi, try a math node set to ping pong.

image

Hope that helps.

4 Likes

Thanks @AlphaChannel and @zeroskilz. The ping pong math node worked.

1 Like