Home

Awesome

a Quark for SuperCollider

install it from within supercollider with the command Quarks.install("Ease") and then recompile.

Ease

Easing and tweening classes for scserver and sclang. Ported from the Cinder C++ framework - original equations by Robert Penner

NOTE: All these expects an input 0-1 as first argument to .value. If you give it out-of-range values the behaviour is undefined.

EaseGallery.new;

overview

Classes

Quadratic

Cubic

Quartic

Quintic

Sine

Exponential

Circular

Bounce

Back

Elastic

Atan

basic usage

e= EaseInAtan(15);
e.value(0)    //0 at the start
e.value(0.5)  //what is the value in the middle of the curve
e.value(1)    //1 at the end

//this can also be written like this to save us from storing the ease object in a variable
EaseInAtan.value(0.5)

//or shorter
EaseInAtan.(0.5)

//to set the curvature you give a second argument
EaseInAtan.(0.5, 10)

//or in the other notation
e= EaseInAtan(10)
e.value(0.5)


//--
a= (0..100)/100;  //a linear ramp with values 0.0 - 1.0
a.collect{|t| EaseInQuad.(t)}.plot;
a.collect{|t| EaseOutQuad.(t)}.plot;
a.collect{|t| EaseInOutQuad.(t)}.plot;


//--similar in sclang and inside synthdefs
s.boot
c= {SinOsc.ar(EaseInOutExpo.kr(MouseX.kr)*500+500, 0, 0.1)}.play
c.free
a.collect{|x| EaseInOutExpo.(x)}.plot


//--rates are flexibe when used inside synthdefs
c= {SinOsc.ar(EaseInAtan.(SinOsc.kr(1)).linlin(0, 1, 500, 5000), 0, 0.1)}.play  //becomes kr
c.free
c= {SinOsc.ar(EaseInAtan.kr(SinOsc.ar(1)).linlin(0, 1, 500, 5000), 0, 0.1)}.play  //kr with ar arg
c.free
c= {SinOsc.ar(EaseInAtan.ar(SinOsc.kr(1)).linlin(0, 1, 500, 5000), 0, 0.1)}.play  //ar with kr arg
c.free


//--nesting
a= (0..100)/100;  //a linear ramp with values 0.0 - 1.0
a.collect{|t| EaseInAtan.(EaseInAtan.(t))}.plot


//--creating an object style
a= (0..100)/100;  //a linear ramp with values 0.0 - 1.0
e= EaseInAtan(3);
f= EaseInAtan(30);
a.collect{|t| [e.(t), f.(t)]}.flop.plot


//even this works...
e.(a).plot



//--use mouse to test
s.boot
c= {SinOsc.ar(EaseInOutQuint.ar(LFSaw.ar(MouseX.kr(1, 9, 1)).range(0, 1)).linexp(0, 1, 400, 800), 0, 0.1)}.play
c.free
c= {SinOsc.ar(EaseOutInExpo.ar(LFSaw.ar(MouseX.kr(1, 9, 1)).range(0, 1)).linexp(0, 1, 400, 800), 0, 0.1)}.play
c.free
c= {SinOsc.ar(EaseInAtan.ar(LFSaw.ar(MouseX.kr(1, 9, 1)).range(0, 1)).linexp(0, 1, 400, 800), 0, 0.1)}.play
c.free
c= {SinOsc.ar(EaseOutInElastic.ar(LFSaw.ar(MouseX.kr(1, 9, 1)).range(0, 1), MouseY.kr(1, 9, 1)).linexp(0, 1, 400, 800), 0, 0.1)}.play
c.free
c= {SinOsc.ar(EaseInBounce.ar(LFSaw.ar(MouseX.kr(1, 9, 1)).range(0, 1), MouseY.kr(1, 9, 1)).linexp(0, 1, 400, 800), 0, 0.1)}.play
c.free