1

I'm trying to consume a couple of easing functions from jQuery UI without having to load the UI library completely.

Reference Source: jQuery easing functions without using a plugin

$.extend($.easing,
{
    def: 'easeOutQuad',
    swing: function (x, t, b, c, d) {
        //alert($.easing.default);
        return $.easing[$.easing.def](x, t, b, c, d);
    },
    easeInQuad: function (x, t, b, c, d) {
        return c*(t/=d)*t + b;
    },
    easeOutQuad: function (x, t, b, c, d) {
        return -c *(t/=d)*(t-2) + b;
    },
    easeInOutQuad: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return c/2*t*t + b;
        return -c/2 * ((--t)*(t-2) - 1) + b;
    },
    easeInCubic: function (x, t, b, c, d) {
        return c*(t/=d)*t*t + b;
    }
});


$(function(){
    (function(){
        $('#the_ribbon').animate({
            top: '+=140',
          }, 1000, function() {
            //Consume an easing function here.
          });
    })();   

});

In particular I would like to be able to consume a bounce like effect, not sure that will be easing (without having to include UI files).

How do I go about referencing and consuming these from the UI source?

Community
  • 1
  • 1
Codex73
  • 5,690
  • 11
  • 56
  • 76
  • 1
    jQuery UI Effects Core + Bounce (you can select only those) is less than 12k, is that too big for you? Also, using UI would allow you to expand your use of those widget/effect methods should the need arise... I guess my question: is why are you making it hard for yourself? –  Apr 19 '12 at 18:14
  • Thanks so much. It makes lot of sense and that will be the efficient method. I guess I'm trying to grasp a more in depth understanding of ".extend". @Yaypaul – Codex73 Apr 19 '12 at 18:27

0 Answers0