Path: blob/trunk/third_party/closure/goog/fx/easing.js
4062 views
/**1* @license2* Copyright The Closure Library Authors.3* SPDX-License-Identifier: Apache-2.04*/56/**7* @fileoverview Easing functions for animations.8*/910goog.provide('goog.fx.easing');111213/**14* Ease in - Start slow and speed up.15* @param {number} t Input between 0 and 1.16* @return {number} Output between 0 and 1.17*/18goog.fx.easing.easeIn = function(t) {19'use strict';20return goog.fx.easing.easeInInternal_(t, 3);21};222324/**25* Ease in with specifiable exponent.26* @param {number} t Input between 0 and 1.27* @param {number} exp Ease exponent.28* @return {number} Output between 0 and 1.29* @private30*/31goog.fx.easing.easeInInternal_ = function(t, exp) {32'use strict';33return Math.pow(t, exp);34};353637/**38* Ease out - Start fastest and slows to a stop.39* @param {number} t Input between 0 and 1.40* @return {number} Output between 0 and 1.41*/42goog.fx.easing.easeOut = function(t) {43'use strict';44return goog.fx.easing.easeOutInternal_(t, 3);45};464748/**49* Ease out with specifiable exponent.50* @param {number} t Input between 0 and 1.51* @param {number} exp Ease exponent.52* @return {number} Output between 0 and 1.53* @private54*/55goog.fx.easing.easeOutInternal_ = function(t, exp) {56'use strict';57return 1 - goog.fx.easing.easeInInternal_(1 - t, exp);58};596061/**62* Ease out long - Start fastest and slows to a stop with a long ease.63* @param {number} t Input between 0 and 1.64* @return {number} Output between 0 and 1.65*/66goog.fx.easing.easeOutLong = function(t) {67'use strict';68return goog.fx.easing.easeOutInternal_(t, 4);69};707172/**73* Ease in and out - Start slow, speed up, then slow down.74* @param {number} t Input between 0 and 1.75* @return {number} Output between 0 and 1.76*/77goog.fx.easing.inAndOut = function(t) {78'use strict';79return 3 * t * t - 2 * t * t * t;80};818283