JavaScript Custom jQuery Easing Function With Access to Value jquery custom easing,jquery custom easing function

I looking up to make a custom easing function to jQuery animate, and I Found a great example to how extend the easing in jQuery. Check it out: Looking for jQuery easing functions without using a plugin.

But this approach does not fit my case.
I have a function that need to process the value not only base in time but also base in start and and value. Example:

$("selector").animate({ "height": "1400px" }, 1000);

the approach that I found uses a function that receives 5 parameters, all of then related with time.

But I need more thatn that. I also need the start value (the value that the DOM has before the animation) and the end value (the value that the DOM will be after the animation).

In my example the value refers to height (original height and 1400px).

I know that you're wondering why I need the value info, so I already wrote my custom function:

var offset = 400;

function myEasing(millisecondsSince, totalMilliseconds, startValue, endValue) {
    var t = millisecondsSince / totalMilliseconds;

    if (startValue == 0) startValue = 0.000001;

    if (t <= 0.5) {
        var m = (Math.log(endValue - offset) - Math.log(startValue))
                / (0.5 * Math.LN10);
        var n = Math.log(startValue) / Math.LN10;
        return Math.pow(10, m * t + n); // y = 10 ^ (mx + n)
    }

    var m = 2 * Math.pow(offset, 0.2);
    return Math.pow(m * t - m, 5) + endValue; // y = (mx - m) ^ 5 + endValue
}

But my problem is how to incorporate this function to jQuery.animate(). Anyone can help me?

Answer:1

This is such a basic thing, I could not figure out. Consider the following: <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></...

This is such a basic thing, I could not figure out. Consider the following: <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></...

I am using node request module to do some get request.I am getting the response body like { body: '\u001f?\b\u0000\u0000\u0000\u0000\u0000...............' } i have the header parameters and ...

I am using node request module to do some get request.I am getting the response body like { body: '\u001f?\b\u0000\u0000\u0000\u0000\u0000...............' } i have the header parameters and ...

  1. decode gzip response
  2. decode gzip response php
  3. decode gzip encoding
  4. decode gzip http response
  5. decode gzip http response java
  6. c# decode gzip response
  7. decode gzip http response online
  8. decode gzip http response python
  9. decode gzip http response c#
  10. curl decode gzip response
  11. decode gzip http response php

I am working on a web page, that has to be 100% high. I did it so, it works fine everywhere, except on Android Firefox. The problem is: When I open the page for first time, in landscape mode - the ...

I am working on a web page, that has to be 100% high. I did it so, it works fine everywhere, except on Android Firefox. The problem is: When I open the page for first time, in landscape mode - the ...

  1. firefox android address bar bottom
  2. firefox android address bar hide
  3. firefox android address bar
  4. firefox android move address bar to bottom
  5. firefox android dark address bar
  6. firefox android remove address bar
  7. firefox android icon in address bar
  8. firefox android auto hide address bar
  9. firefox android always show address bar

I am trying to upload doc or docx files in my application : The view : <div class="col-xs-12"> <input type="file" ng-file-select="onFileSelect($files)"/> <table> &...

I am trying to upload doc or docx files in my application : The view : <div class="col-xs-12"> <input type="file" ng-file-select="onFileSelect($files)"/> <table> &...