ludo.svg.easing

ludo.svg.


new ludo.svg.easing()

Easing methods for SVG animations.

To see how the different functions work, see the SVG animation demo.

Source:
Example
circle.animate({
     cx : 100, cy: 100, r: 10
}, {
     duration: 200,
     easing: ludo.svg.easing.outCubic,
     complete: function(){ console.log('finished') }
});

Methods


<static> bounce()

bounce easing functions

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.bounce
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> bounce()

bounce easing functions

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.outCirc
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> elastic()

elastic easing functions

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.elastic
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> inCirc()

inCirc easing functions
circular easing in - accelerating from zero velocity

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.inCirc
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> inCubic()

inCubic easing functions

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.inCubic
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> inExpo()

inExpo easing functions
exponential easing in - accelerating from zero velocity

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.inExpo
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> inOutCirc()

inOutCirc easing functions
circular easing in/out - acceleration until halfway, then deceleration

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.inOutCirc
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> inOutCubic()

inOutCubic easing functions

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.inOutCubic
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> inOutExpo()

inOutExpo easing functions
exponential easing in/out - accelerating until halfway, then decelerating

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.inOutExpo
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> inOutQuad()

inOutQuad easing functions

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.inOutQuad
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> inOutQuart()

inOutQuart easing functions

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.inOutQuart
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> inOutQuint()

inOutQuint easing functions

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.inOutQuint
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> inQuad()

inQuad easing functions

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.inQuad
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> inQuart()

inQuart easing functions

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.inQuart
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> inQuint()

inQuint easing functions

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.inQuint
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> inSine()

inSine easing functions

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.inSine
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> linear()

Source:
Example
var v = new ludo.View({
     renderTo: document.body,
     layout:{
         width:'matchParent', height:'matchParent'
     }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50 });
circle.css('fill', '#ff0000');
svg.append(circle);
circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.linear
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> outCirc()

outCirc easing functions
circular easing out - decelerating to zero velocity

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.outCirc
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> outCubic()

outCubic easing functions

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.outCubic
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> outExpo()

outExpo easing functions
exponential easing out - decelerating to zero velocity

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.outExpo
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> outQuad()

outQuad easing functions

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.outQuad
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> outQuart()

outQuart easing functions

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.outQuart
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> outQuint()

outQuint easing functions

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.outQuint
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> outSine()

outSine easing functions
sinusoidal easing in/out - accelerating until halfway, then decelerating

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.outSine
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});

<static> outSine()

outSine easing functions

Source:
Example
var v = new ludo.View({
     renderTo: document.body, layout:{ width:'matchParent', height:'matchParent'  }
});
var svg = v.svg();

var circle = svg.$('circle', { cx: 100, cy: 100, r: 50, fill: '#ff0000' });
svg.append(circle);

circle.animate({
     cx:300, cy: 200
},{
     easing: ludo.svg.easing.outSine
     duration: 1000,
     complete:function(){
         console.log('completed');
  }
});