123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- import { Easing } from "@tweenjs/tween.js";
- /**
- * Easing functions for use with TweenCollection. These function are from
- * {@link https://github.com/sole/tween.js/|Tween.js} and Robert Penner. See the
- * {@link http://sole.github.io/tween.js/examples/03_graphs.html|Tween.js graphs for each function}.
- *
- * @namespace
- */
- const EasingFunction = {
- /**
- * Linear easing.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- LINEAR_NONE: Easing.Linear.None,
- /**
- * Quadratic in.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- QUADRATIC_IN: Easing.Quadratic.In,
- /**
- * Quadratic out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- QUADRATIC_OUT: Easing.Quadratic.Out,
- /**
- * Quadratic in then out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- QUADRATIC_IN_OUT: Easing.Quadratic.InOut,
- /**
- * Cubic in.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- CUBIC_IN: Easing.Cubic.In,
- /**
- * Cubic out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- CUBIC_OUT: Easing.Cubic.Out,
- /**
- * Cubic in then out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- CUBIC_IN_OUT: Easing.Cubic.InOut,
- /**
- * Quartic in.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- QUARTIC_IN: Easing.Quartic.In,
- /**
- * Quartic out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- QUARTIC_OUT: Easing.Quartic.Out,
- /**
- * Quartic in then out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- QUARTIC_IN_OUT: Easing.Quartic.InOut,
- /**
- * Quintic in.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- QUINTIC_IN: Easing.Quintic.In,
- /**
- * Quintic out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- QUINTIC_OUT: Easing.Quintic.Out,
- /**
- * Quintic in then out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- QUINTIC_IN_OUT: Easing.Quintic.InOut,
- /**
- * Sinusoidal in.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- SINUSOIDAL_IN: Easing.Sinusoidal.In,
- /**
- * Sinusoidal out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- SINUSOIDAL_OUT: Easing.Sinusoidal.Out,
- /**
- * Sinusoidal in then out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- SINUSOIDAL_IN_OUT: Easing.Sinusoidal.InOut,
- /**
- * Exponential in.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- EXPONENTIAL_IN: Easing.Exponential.In,
- /**
- * Exponential out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- EXPONENTIAL_OUT: Easing.Exponential.Out,
- /**
- * Exponential in then out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- EXPONENTIAL_IN_OUT: Easing.Exponential.InOut,
- /**
- * Circular in.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- CIRCULAR_IN: Easing.Circular.In,
- /**
- * Circular out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- CIRCULAR_OUT: Easing.Circular.Out,
- /**
- * Circular in then out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- CIRCULAR_IN_OUT: Easing.Circular.InOut,
- /**
- * Elastic in.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- ELASTIC_IN: Easing.Elastic.In,
- /**
- * Elastic out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- ELASTIC_OUT: Easing.Elastic.Out,
- /**
- * Elastic in then out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- ELASTIC_IN_OUT: Easing.Elastic.InOut,
- /**
- * Back in.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- BACK_IN: Easing.Back.In,
- /**
- * Back out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- BACK_OUT: Easing.Back.Out,
- /**
- * Back in then out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- BACK_IN_OUT: Easing.Back.InOut,
- /**
- * Bounce in.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- BOUNCE_IN: Easing.Bounce.In,
- /**
- * Bounce out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- BOUNCE_OUT: Easing.Bounce.Out,
- /**
- * Bounce in then out.
- *
- * @type {EasingFunction.Callback}
- * @constant
- */
- BOUNCE_IN_OUT: Easing.Bounce.InOut,
- };
- /**
- * Function interface for implementing a custom easing function.
- * @callback EasingFunction.Callback
- * @param {number} time The time in the range <code>[0, 1]</code>.
- * @returns {number} The value of the function at the given time.
- *
- * @example
- * function quadraticIn(time) {
- * return time * time;
- * }
- *
- * @example
- * function quadraticOut(time) {
- * return time * (2.0 - time);
- * }
- */
- export default Object.freeze(EasingFunction);
|