Search code examples
jqueryjointjs

how to animate drop a element in paper using jointjs


I want to animate an object in a graph when we drop the element.

new joint.dia.Graph().on({

    'add': function(cell, collection, opt) {

        // Here I want to animate the element while dropped.
    }

});

Any idea how to solve this?


Solution

  • Need to add the following code to animate the element.

    cell.transition('position/y',250, { 
                duration: 200,
                timingFunction: function(t) { return t*t; },
                valueFunction: function(a, b) { 
                    return function(t) { return a + (b - a) * t }}
    });