Translate & animate noise relative to mouse position

Hello everyone,

I am super new to TouchDesigner, so I am doing a bunch of tutorials and trying to modify them so see if I understand well.

One of the first thing I tried was to use a noise to generate a Normal Map to build a terrain. Then for translate y value (ty) I use a negative Absolute time (-$AT).
I then create a Mouse In Operator called mouse, and use -chop(‘mouse/tx’) as the x translate value for the noise (tx).

ty = -$AT
tx = -chop('mouse/tx')

This does work fine but only moves the noise left and right.
What I’d actually like to do is move the noise in diagonal, in an angle relative to the x position of the mouse. I figured that something like would do the trick:

ty = -$AT
tx = -chop('mouse/tx') * $AT

It does but the noise (and the map) is all jumpy while I move the mouse. When I stop moving the mouse, the noise moves at the desired angle. Here is a small capture of what it looks like ( I also attached the camera position to the mouse Y).

Not sure what causes this… What I’d like to have is a smooth motion while I move the mouse.

Thanks for your help!

Welcome @remka!

Part of what’s happening here is that your translations are relatively large and fast - one approach would be to use a lag or filter CHOP to smooth the changes in your mouse position. That should help give you some smoother movement in your animation.

Another option would be to use a speed CHOP attached to normalized mouse coordinates - this would give you an increasing / decreasing value that was based on your mouse position that might be easier to control:

mouse-speed

The other bit worth thinking about is moving towards python as your scripting default. There are still some pieces that are T-Script based in TD, but most of the tutorials you’ll find these days focus on the python expressions for references.

Thank you @ raganmd for the warm welcome!

This helps a lot.

I suspected something like this (ie. too fast translations), was looking at some kind of slow ramping solution (var = varToReach * 0.5 or something for smoothing) , but coming from “traditional” coding I couldn’t find it (still have to wrap my head around the node paradigm, I still think in variables).

Now I need to take a serious look at how the Speed OP works.
Thanks again!

-absTime.seconds

Would be the proper Python syntax I assume then.
I’m more confortable with Python so this is good! ($ something reminds me of PHP, not my favorite language).

From the help menu or by right clicking on an operator you can get to Op Snippets this is a kind of help / reference set that can demystify some of the pieces about operators and how they’re used. The scripting pieces in Touch are also pretty rad - the python integration and the ability to create your own python extensions or C++ operators is pretty rad.

Here’s the quick ref to the Python pieces that might help you get moving faster: