Random sleep command issue

Little issue with the sleep command not working the way it I think it should.

I have this little script:

set i = 0

while ($i < 1)
set i = $i+ .01
opparm cross1 cross ($i)
sleep 30
echo $i
end

As a way to blend the output of a “v” value from a multitouch screen so that the starting position of the geo does not jump all over the place when you first touch the screen but rather gradually moves to the touch position over a set time. Currently that time is set to 3 seconds.
The problem I am having is that the sleep rather than pausing the while loop for 30 milliseconds and moving to the next, it is pausing for the entire 3 seconds and moving from 0 to 1 all at once.

Is this me not using the sleep command it the correct way or is this a problem with the way the command works within a loop.

the command is working correctly. sleep will pause TouchDesigner

what you are looking for is the run command with a delay of 30 ms, and passing the increment as the argument.

you could also trying using the lag CHOP to smooth out the position instead of scripting.

Selina

Yea thats kinda what I thought, have been looking around for something like a thread to use like a dummy and avoid pausing TD. But got it to work with a lfo → count → math. Like the idea of a lag though it’s a bit choppy a the beginning. Thanks for the advice

hey the filter chop might help with that too.

rod.