Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
SeleniumHQ
GitHub Repository: SeleniumHQ/Selenium
Path: blob/trunk/third_party/closure/goog/fx/easing.js
4062 views
1
/**
2
* @license
3
* Copyright The Closure Library Authors.
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
/**
8
* @fileoverview Easing functions for animations.
9
*/
10
11
goog.provide('goog.fx.easing');
12
13
14
/**
15
* Ease in - Start slow and speed up.
16
* @param {number} t Input between 0 and 1.
17
* @return {number} Output between 0 and 1.
18
*/
19
goog.fx.easing.easeIn = function(t) {
20
'use strict';
21
return goog.fx.easing.easeInInternal_(t, 3);
22
};
23
24
25
/**
26
* Ease in with specifiable exponent.
27
* @param {number} t Input between 0 and 1.
28
* @param {number} exp Ease exponent.
29
* @return {number} Output between 0 and 1.
30
* @private
31
*/
32
goog.fx.easing.easeInInternal_ = function(t, exp) {
33
'use strict';
34
return Math.pow(t, exp);
35
};
36
37
38
/**
39
* Ease out - Start fastest and slows to a stop.
40
* @param {number} t Input between 0 and 1.
41
* @return {number} Output between 0 and 1.
42
*/
43
goog.fx.easing.easeOut = function(t) {
44
'use strict';
45
return goog.fx.easing.easeOutInternal_(t, 3);
46
};
47
48
49
/**
50
* Ease out with specifiable exponent.
51
* @param {number} t Input between 0 and 1.
52
* @param {number} exp Ease exponent.
53
* @return {number} Output between 0 and 1.
54
* @private
55
*/
56
goog.fx.easing.easeOutInternal_ = function(t, exp) {
57
'use strict';
58
return 1 - goog.fx.easing.easeInInternal_(1 - t, exp);
59
};
60
61
62
/**
63
* Ease out long - Start fastest and slows to a stop with a long ease.
64
* @param {number} t Input between 0 and 1.
65
* @return {number} Output between 0 and 1.
66
*/
67
goog.fx.easing.easeOutLong = function(t) {
68
'use strict';
69
return goog.fx.easing.easeOutInternal_(t, 4);
70
};
71
72
73
/**
74
* Ease in and out - Start slow, speed up, then slow down.
75
* @param {number} t Input between 0 and 1.
76
* @return {number} Output between 0 and 1.
77
*/
78
goog.fx.easing.inAndOut = function(t) {
79
'use strict';
80
return 3 * t * t - 2 * t * t * t;
81
};
82
83