Page 1 of 1

Sine Sliders

Posted: 28 Mar 2014 09:24
by MrCorba
Hey guys got a scripting question.

I've got a StepSlider object and I would like a button, that will set the Sliders in a Sine form. Probably if someone gives the answer I'll be like Dôh! but for now I'm just not seem to get it working.

Re: Sine Sliders

Posted: 28 Mar 2014 09:37
by Softcore
Assuming the StepSlider object in your template is named "StepSlider" add a script on expression x, rising from zero, inside the button (preferably of Pad nature and not switch).

Type in the script

Code: Select all

decl i,length=sizeof(StepSlider.x);

for (i=0;i<length;i++){
StepSlider.x[i]=(1 + sin(i*2*pi/(length)-(pi*.5)))*.5;
}
if you want it to start with the max value of the sine

Code: Select all

decl i,length=sizeof(StepSlider.x);

for (i=0;i<length;i++){
StepSlider.x[i]=(1+sin(i*2*pi/(length)+(pi*.5))*.5;
}
if you want it to start with the half value of the sine

Code: Select all

decl i,length=sizeof(StepSlider.x);

for (i=0;i<length;i++){
StepSlider.x[i]=(1+sin(i*2*pi/(length)))*.5;
}

Re: Sine Sliders

Posted: 28 Mar 2014 10:05
by MrCorba
Awesome! Thanks!

Re: Sine Sliders

Posted: 28 Mar 2014 12:26
by Softcore
Dont thank me - thank Mark Strauss (LFO Studio template) and Antonio Blanca (AB faderlab template)....You can find more maths in those (tri, sawtooth, etc). ;)