# Mapping values to a curve

Hi everyone, my question would be about how to map a range of values in a non-linear way, and in more ways than just square and root curves, preferably with a custom CHOP trail curve.
I need this in the context of making a custom Slider component, I’ve exposed the range parameter by pointing to an internal math CHOP, but this is always done linearly. I want to use the values of a trail CHOP, which would shape the mapping curve.
I explain myself: a positive bell shaped curve with an amplitude of 4 would map the range 0-1 to the range 1-2 sort of like this

``````0 - 1
.25 - 2
.5 - 4
.75 - 3
1 - 2
``````

I’m not sure if I get the idea across, in the future I would also like to be able to edit this curve manually, with the constraints of a given amplitude, and an start/end value given by the “To Range” parameter that I would like to end up with.

Perhaps a Lookup CHOP? This is in the Lookup CHOP Snippet for example:

the Animation COMP will do the job very well

Example file below
Animation COMP.toe (5.1 KB)
.

Click on ‘Edit Animation’ to tweak the points position and their value.
For precise points and values use the ‘F:’ and ‘V:’ fields.
The Function field is were you can set the different curves (linear, ease, cubic, bezier etc…)
.

In the file example I created a few different animations based on the values you have provided, and rescaled the animation range to be 0 to 1000 just to give me more room to play with the curve.

The Animation COMP is a bit buggy and could be a bit stubborn sometimes to work with, but it does the job very well once it’s up and running.

I hope this helps!

3 Likes

PS: forgot to say.
move the slider to move through the curve in the Animation COMP.
In this case the slider is used as index for the Animation COMP, but you can drive the Animation with pretty much anything (LFO, noise, another Animation, a kinect etc…)

Although the animation COMP in the example has been rescaled to 0 -1000, you will still be using your 0-1 range from the slider.

That is exactly what I needed! Thank you everyone for the fast responses
I’ve included a .tox component of the Control board with custom curves that I wanted to make:
Control_board.tox (7.8 KB)

As well as two small assets that it needs in order to work, just copy the slider and the sliderhead images to the samples map folder of your TD installation (Samples/Map)

1 Like