1

I wanted to perform Easing on an iOS application but the closest thing I could find was in JavaScript. Here it is

const Easing = {

QuadraticInOut: function (k) {
    if ((k *= 2) < 1) {
        return 0.5 * k * k;
    }

    return - 0.5 * (--k * (k - 2) - 1);
}, 
 }

What does it mean ?

  • 1
    What's the question? This is a mathematical function that interpolates. – tadman Mar 28 '17 at 20:37
  • 1
    Are you referring to CSS animations? – Jack Mar 28 '17 at 20:39
  • you could have a look here: http://stackoverflow.com/q/38497765/1447675 – Nina Scholz Mar 28 '17 at 20:40
  • see the bezier cubic interpolation function. 'Easing' is just a function of time smoothed out. [see this question also](http://stackoverflow.com/questions/25726563/what-is-the-default-animation-easing-function-in-ios) – Rico Kahler Mar 28 '17 at 20:41
  • [Easing](https://en.wikipedia.org/wiki/Inbetweening#Digital_animation) has nothing to do with javascript in particular. It's the way a property is animated. – Bergi Mar 28 '17 at 20:55
  • @tadman I don't know what the above data Structure / type is. It looks like a `function` is being set equal to a `constant` but its confusing. And the last line that returns has _decrement operator_` `--k` in it.I also don't understand why one would need that. –  Mar 29 '17 at 04:42
  • @Jack yes I am. It has to do with dragging a curve with control points. –  Mar 29 '17 at 04:43
  • Thanks for the suggestion guys –  Mar 29 '17 at 04:52
  • 2
    @Tyrone it's hard to tell because it's badly formatted, but it's a property on an object, you can call it just like any other function, e.g. `Easing.QuadraticInOut(3);`. If you want to just use these on CSS animations there's a built in facility for that, without the need for JavaScript, [see here](https://www.w3schools.com/css/css3_animations.asp) – Jack Mar 29 '17 at 07:51

0 Answers0