How to use the raphael.easing_formulas function in raphael

To help you get started, we’ve selected a few raphael examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SonyCSLParis / NONOTO / record_audio.ts View on Github external
'stroke-width': 0,
        fill: '#666'
    }).data("id", "weight");

    var vertex = opts.paper.circle(x, y, 7).attr({
        'stroke-width': 0,
        fill: '#CCC'
    }).data("id", "vertex");

    var label = opts.paper.text(x, y + 20, "").attr({
        "text-anchor": "center",
        "font-size": 14
    });

    var mn = opts.paper.set(arm, weight);
    Raphael.easing_formulas.sinoid = function(n) { return Math.sin(Math.PI * n / 2) };

return {
    start: function(tempo, repeats) {
                tick_count = 0;
                mn.attr("transform", "R-20 " + x + "," + y);
                var interval = 120000 / tempo;

         var ticktockAnimationParam = {
            "50%": { transform:"R20 " + x + "," + y, easing: "sinoid", callback: () => {if (playSound) {
                            sound.play();}}},
            "100%": { transform:"R-20 " + x + "," + y, easing: "sinoid", callback: () => {if (playSound) {
                            sound.play();}}}
          };
                //animation
    			var ticktock = Raphael.animation(ticktockAnimationParam, interval).repeat(repeats / 2);
    			arm.animate(ticktock);