General
Sine Sliders
Started by MrCorba on .
Sign in or create an account to join the conversation.
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.
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.
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
Type in the script
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
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
decl i,length=sizeof(StepSlider.x);
for (i=0;i<length;i++){
StepSlider.x[i]=(1+sin(i*2*pi/(length)))*.5;
}Awesome! Thanks!
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). 