Login | Register 
FEATURES
APPLICATIONS
DOWNLOADS
EDUCATION
BLOG
WIKI
FORUM
STORE

Widget: Modulo Horiz Slider?

Helpful techniques for working with TouchDesigner. Answers only, no questions.

Widget: Modulo Horiz Slider?

Postby flowb » Wed Jul 03, 2019 1:03 am

Hi,

I was poking around with the new widgets in the palette and they are lovely.

I was digging around in the horiz slider and, really digging the 'relative mode' setting. Now I'm trying to find a crafty way to make it so that it essentially wraps it's value. As in, once you have moved it all the way to one extreme, a further swipe in that direction wraps the value to the other end of the slider and back towards center.

Does anyone have any tips?

Thanks!
User avatar
flowb
 
Posts: 117
Joined: Fri Dec 05, 2014 2:00 pm
Location: Los Angeles

Re: Widget: Modulo Horiz Slider?

Postby flowb » Wed Jul 03, 2019 1:11 pm

Nevermind.

Found it in [widget]/slider0/SliderExt DAT

replace:
Code: Select all
def ClampMinMax(self, value):
    return max(0, min(value, 1))


with:
Code: Select all
def ClampMinMax(self, value):
    return value%1


it would probably be tidier to create a wrapping function definition (ie: 'ClampWrapped') and call that instead but, this quick hack solves it.:)

Digging these new widgets a ton!
User avatar
flowb
 
Posts: 117
Joined: Fri Dec 05, 2014 2:00 pm
Location: Los Angeles


Return to Techniques

Who is online

Users browsing this forum: No registered users and 3 guests