Re: [web-animations] feedback

More powerful easings are something I think we definitely need in the API,
and something we've discussed before during specification meetings.

With specific regard to easings as javaScript functions: currently there
are performance reasons why we don't want to support this. In particular,
having javaScript be part of the timing calculations would force an
animation off browser fast paths.

Note that you can achieve a similar result (although with additional
verbosity) by using custom effects and a paused animation:

var parentPlayer = new Animation(null, callChildPlayer,
otherTimingProperties);
var childPlayer = new Animation(..., 1);
childPlayer.pause();
function callChildPlayer(tf) {
  var scaled_tf = myTimingFunction(tf);
  childPlayer.currentTime = scaled_tf;
}

However, this isn't going to perform as well as an animation that uses a
standard easing.

Cheers,
    -Shane


On Mon Dec 15 2014 at 7:57:22 PM Emad Eid <eeid@comcast.net> wrote:

>
>
> Comment on what Jeremie Patonnier said:
>
> *Not yet :-/ ISSUE 7 on the spec propose to improve the cubic-bezier
> easing*
>
> *function definition to allow an arbitrary number of point, which allows
> to*
>
> *create any useful easing function (I'm all for this extension). Such*
>
> *extended cubic-bezier function will allow to handle any type of
> functions,*
>
> *including elastic and bounce.*
>
>
>
> Why the easing definition has to be a String. Why not be able to provide
> js function for easing
>
> Something like.
>
> var easing =  function bounce (k) {
>
>     if ( ( k /= 1 ) < ( 1 / 2.75 ) ) {
>
>         return 7.5625 * k * k;
>
>     } else if ( k < ( 2 / 2.75 ) ) {
>
>         return 7.5625 * ( k -= ( 1.5 / 2.75 ) ) * k + 0.75;
>
>     } else if ( k < ( 2.5 / 2.75 ) ) {
>
>         return 7.5625 * ( k -= ( 2.25 / 2.75 ) ) * k + 0.9375;
>
>     } else {
>
>         return 7.5625 * ( k -= ( 2.625 / 2.75 ) ) * k + 0.984375;
>
>     }
>
> };
>
>
>
> Thank you
>
> Emad
>
>
>

Received on Monday, 15 December 2014 09:22:41 UTC