counting from value to value, slider value goes fluently to new slider value

Apr 1, 2010 at 6:06pm

counting from value to value, slider value goes fluently to new slider value

Hi, Im trying hard to fade fluently from one value to another. trying to control servos slowly from old value to new. Basically try to imagine slider on one left and slider on right. If I click on left one, the right one slides to the new value fluently, in speed x (metro for ex.).

patch: http://cycling74.com/forums/topic.php?id=25637
I tried to solve that using [counter], but its hard to set up correctly when it should count up and down. It not always works, for ex. if the new number is not bigger than the number before the previous.

Perhaps there is some object making this really easy.

#49480
Apr 1, 2010 at 7:37pm

If I understand your request, I think [line] might help here: [slider]->[$1 100] message -> [line] -> [slider]. That’s the simplest way to do it in Max; but i’ve never used serial-output to control servos.

#177712
Apr 1, 2010 at 8:33pm

great! now I will just relativize speed for different values to fade (now same time to fade from 1-100 as 1-10) and its done. :)
thanks

#177713
Apr 1, 2010 at 8:54pm

not sure about the last bit, but maybe look at: [maximum], [peak], [scale] and related objects; you might be able to cobble something together – there are some geniuses on this forum who could do this in their sleep…

#177714
Apr 1, 2010 at 9:11pm

scale: I though so.
geniuses: I’m sure about that. ;)

#177715
Apr 1, 2010 at 9:14pm

I usually title such requests with the words ‘simple math problem’, and the responses are many, fast, and always right..good luck

#177716
Apr 1, 2010 at 9:45pm

This should get you started (It does what you need if I’m understanding correctly).

Although there is a problem with the method, in that if you set a new destination value before line has finished ramping, line might have to “jump” to the old destination value (now the starting value). It may not be an issue unless your ramp time is long though.

– Pasted Max Patch, click to expand. –
#177717
Sep 9, 2010 at 12:22am

Thanks a lot Tim!

Saved my project.

#177718

You must be logged in to reply to this topic.