├── icon.png ├── LICENSE ├── README.md ├── EasingFunctions_V2.gd ├── EasingFunctions.gd └── EasingFunctions_V3.gd /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ferdiu/godot-easing-functions/HEAD/icon.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Federico 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Easing functions for Godot (v3.2.x) 2 | 3 | ![LOGO](/icon.png) 4 | 5 | Bring the powerful easing functions to godot 6 | 7 | ## Usage 8 | 9 | Copy the script in your project resource folder and call them as: 10 | 11 | > Easing.[TYPE].[FUNC](t, b, c, d) 12 | 13 | or for `Vector2` object: 14 | 15 | > EasingV2.[TYPE].[FUNC](t, b, c, d) 16 | 17 | or for `Vector3` object: 18 | 19 | > EasingV3.[TYPE].[FUNC](t, b, c, d) 20 | 21 | inside your code. 22 | 23 | *Sorry about using different `class names` for each data type but GDScript does not support (at this time) Function Overloading.* 24 | 25 | example: 26 | 27 | var t = 0 28 | 29 | func _process(delta): 30 | t += delta 31 | position.x = Easing.Expo.EaseOut(t, 0.0, 100.0, 3.0) 32 | 33 | this moves on the x axis an object from position 0.0 to position 100.0 in 3 seconds decreasing the speed exponentially. 34 | 35 | #### TYPE available 36 | 37 | - `Back` 38 | - `Bounce` 39 | - `Circ` 40 | - `Cubic` 41 | - `Elastic` 42 | - `Expo` 43 | - `Linear` 44 | - `Quad` 45 | - `Quart` 46 | - `Quint` 47 | - `Sine` 48 | 49 | #### FUNC available 50 | 51 | - `EaseIn` 52 | - `EaseOut` 53 | - `EaseInOut` 54 | - `EaseOutIn` 55 | - `EaseNone` (just for `Linear` type) 56 | 57 | (For `Linear` type all FUNC are the same) 58 | 59 | ## Useful resources 60 | 61 | - Preview easing functions (https://easings.net/) 62 | - Original Robert Penner's Easing Functions at http://robertpenner.com/easing/ 63 | - Original Terms of Use: http://robertpenner.com/easing_terms_of_use.html 64 | -------------------------------------------------------------------------------- /EasingFunctions_V2.gd: -------------------------------------------------------------------------------- 1 | #Terms of Use: Easing Functions (Equations) 2 | # 3 | #Open source under the MIT License and the 3-Clause BSD License. 4 | # 5 | # 6 | #MIT License 7 | # 8 | #Copyright © 2001 Robert Penner 9 | # 10 | #Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 11 | # 12 | #The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13 | # 14 | #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | # 16 | # 17 | #BSD License 18 | # 19 | #Copyright © 2001 Robert Penner 20 | # 21 | #Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 22 | # 23 | #Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 24 | #Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 25 | #Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. 26 | # 27 | #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE, DATA, OR PROFITS OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | # easing functions 30 | 31 | # t = elapsed time 32 | # b = begin 33 | # c = change = ending - beginning 34 | # d = duration 35 | 36 | # easing function make a value change from "b" to "b + c" 37 | # in time from "t = 0" to "t = t + d" 38 | 39 | class_name EasingV2 40 | 41 | class Back: 42 | # s = amplitude for "back" variation 43 | static func EaseIn(t: float, b: Vector2, c: Vector2, d: float, s: float = 1.70158) -> Vector2: 44 | return Vector2(Easing.Back.EaseIn(t, b.x, c.x, d, s), Easing.Back.EaseIn(t, b.y, c.y, d, s)) 45 | 46 | static func EaseOut(t: float, b: Vector2, c: Vector2, d: float, s: float = 1.70158) -> Vector2: 47 | return Vector2(Easing.Back.EaseOut(t, b.x, c.x, d, s), Easing.Back.EaseOut(t, b.y, c.y, d, s)) 48 | 49 | static func EaseInOut(t: float, b: Vector2, c: Vector2, d: float, s: float = 1.70158) -> Vector2: 50 | return Vector2(Easing.Back.EaseInOut(t, b.x, c.x, d, s), Easing.Back.EaseInOut(t, b.y, c.y, d, s)) 51 | 52 | static func EaseOutIn(t: float, b: Vector2, c: Vector2, d: float, s: float = 1.70158) -> Vector2: 53 | return Vector2(Easing.Back.EaseOutIn(t, b.x, c.x, d, s), Easing.Back.EaseOutIn(t, b.y, c.y, d, s)) 54 | 55 | class Bounce: 56 | 57 | static func EaseOut(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 58 | return Vector2(Easing.Bounce.EaseOut(t, b.x, c.x, d), Easing.Bounce.EaseOut(t, b.y, c.y, d)) 59 | 60 | static func EaseIn(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 61 | return Vector2(Easing.Bounce.EaseIn(t, b.x, c.x, d), Easing.Bounce.EaseIn(t, b.y, c.y, d)) 62 | 63 | static func EaseInOut(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 64 | return Vector2(Easing.Bounce.EaseInOut(t, b.x, c.x, d), Easing.Bounce.EaseInOut(t, b.y, c.y, d)) 65 | 66 | static func EaseOutIn(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 67 | return Vector2(Easing.Bounce.EaseOutIn(t, b.x, c.x, d), Easing.Bounce.EaseOutIn(t, b.y, c.y, d)) 68 | 69 | class Circ: 70 | 71 | static func EaseIn(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 72 | return Vector2(Easing.Circ.EaseIn(t, b.x, c.x, d), Easing.Circ.EaseIn(t, b.y, c.y, d)) 73 | 74 | static func EaseOut(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 75 | return Vector2(Easing.Circ.EaseOut(t, b.x, c.x, d), Easing.Circ.EaseOut(t, b.y, c.y, d)) 76 | 77 | static func EaseInOut(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 78 | return Vector2(Easing.Circ.EaseInOut(t, b.x, c.x, d), Easing.Circ.EaseInOut(t, b.y, c.y, d)) 79 | 80 | static func EaseOutIn(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 81 | return Vector2(Easing.Circ.EaseOutIn(t, b.x, c.x, d), Easing.Circ.EaseOutIn(t, b.y, c.y, d)) 82 | 83 | class Cubic: 84 | 85 | static func EaseIn(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 86 | return Vector2(Easing.Cubic.EaseIn(t, b.x, c.x, d), Easing.Cubic.EaseIn(t, b.y, c.y, d)) 87 | 88 | static func EaseOut(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 89 | return Vector2(Easing.Cubic.EaseOut(t, b.x, c.x, d), Easing.Cubic.EaseOut(t, b.y, c.y, d)) 90 | 91 | static func EaseInOut(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 92 | return Vector2(Easing.Cubic.EaseInOut(t, b.x, c.x, d), Easing.Cubic.EaseInOut(t, b.y, c.y, d)) 93 | 94 | static func EaseOutIn(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 95 | return Vector2(Easing.Cubic.EaseOutIn(t, b.x, c.x, d), Easing.Cubic.EaseOutIn(t, b.y, c.y, d)) 96 | 97 | class Elastic: 98 | # a = amplitude; p = period 99 | static func EaseIn(t: float, b: Vector2, c: Vector2, d: float, a: float = 0, p: float = 0) -> Vector2: 100 | return Vector2(Easing.Elastic.EaseIn(t, b.x, c.x, d, a, p), Easing.Elastic.EaseIn(t, b.y, c.y, d, a, p)) 101 | 102 | static func EaseOut(t: float, b: Vector2, c: Vector2, d: float, a: float = 0, p: float = 0) -> Vector2: 103 | return Vector2(Easing.Elastic.EaseOut(t, b.x, c.x, d, a, p), Easing.Elastic.EaseOut(t, b.y, c.y, d, a, p)) 104 | 105 | static func EaseInOut(t: float, b: Vector2, c: Vector2, d: float, a: float = 0, p: float = 0) -> Vector2: 106 | return Vector2(Easing.Elastic.EaseInOut(t, b.x, c.x, d, a, p), Easing.Elastic.EaseInOut(t, b.y, c.y, d, a, p)) 107 | 108 | static func EaseOutIn(t: float, b: Vector2, c: Vector2, d: float, a: float = 0, p: float = 0) -> Vector2: 109 | return Vector2(Easing.Elastic.EaseOutIn(t, b.x, c.x, d, a, p), Easing.Elastic.EaseOutIn(t, b.y, c.y, d, a, p)) 110 | 111 | class Expo: 112 | 113 | static func EaseIn(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 114 | return Vector2(Easing.Expo.EaseIn(t, b.x, c.x, d), Easing.Expo.EaseIn(t, b.y, c.y, d)) 115 | 116 | static func EaseOut(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 117 | return Vector2(Easing.Expo.EaseOut(t, b.x, c.x, d), Easing.Expo.EaseOut(t, b.y, c.y, d)) 118 | 119 | static func EaseInOut(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 120 | return Vector2(Easing.Expo.EaseInOut(t, b.x, c.x, d), Easing.Expo.EaseInOut(t, b.y, c.y, d)) 121 | 122 | static func EaseOutIn(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 123 | return Vector2(Easing.Expo.EaseOutIn(t, b.x, c.x, d), Easing.Expo.EaseOutIn(t, b.y, c.y, d)) 124 | 125 | class Linear: 126 | 127 | static func EaseNone(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 128 | return Vector2(Easing.Linear.EaseIn(t, b.x, c.x, d), Easing.Linear.EaseIn(t, b.y, c.y, d)) 129 | 130 | static func EaseIn(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 131 | return Vector2(Easing.Linear.EaseIn(t, b.x, c.x, d), Easing.Linear.EaseIn(t, b.y, c.y, d)) 132 | 133 | static func EaseOut(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 134 | return Vector2(Easing.Linear.EaseOut(t, b.x, c.x, d), Easing.Linear.EaseOut(t, b.y, c.y, d)) 135 | 136 | static func EaseInOut(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 137 | return Vector2(Easing.Linear.EaseInOut(t, b.x, c.x, d), Easing.Linear.EaseInOut(t, b.y, c.y, d)) 138 | 139 | static func EaseOutIn(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 140 | return Vector2(Easing.Linear.EaseOutIn(t, b.x, c.x, d), Easing.Linear.EaseOutIn(t, b.y, c.y, d)) 141 | 142 | class Quad: 143 | 144 | static func EaseIn(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 145 | return Vector2(Easing.Quad.EaseIn(t, b.x, c.x, d), Easing.Quad.EaseIn(t, b.y, c.y, d)) 146 | 147 | static func EaseOut(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 148 | return Vector2(Easing.Quad.EaseOut(t, b.x, c.x, d), Easing.Quad.EaseOut(t, b.y, c.y, d)) 149 | 150 | static func EaseInOut(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 151 | return Vector2(Easing.Quad.EaseInOut(t, b.x, c.x, d), Easing.Quad.EaseInOut(t, b.y, c.y, d)) 152 | 153 | static func EaseOutIn(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 154 | return Vector2(Easing.Quad.EaseOutIn(t, b.x, c.x, d), Easing.Quad.EaseOutIn(t, b.y, c.y, d)) 155 | 156 | class Quart: 157 | 158 | static func EaseIn(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 159 | return Vector2(Easing.Quart.EaseIn(t, b.x, c.x, d), Easing.Quart.EaseIn(t, b.y, c.y, d)) 160 | 161 | static func EaseOut(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 162 | return Vector2(Easing.Quart.EaseOut(t, b.x, c.x, d), Easing.Quart.EaseOut(t, b.y, c.y, d)) 163 | 164 | static func EaseInOut(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 165 | return Vector2(Easing.Quart.EaseInOut(t, b.x, c.x, d), Easing.Quart.EaseInOut(t, b.y, c.y, d)) 166 | 167 | static func EaseOutIn(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 168 | return Vector2(Easing.Quart.EaseOutIn(t, b.x, c.x, d), Easing.Quart.EaseOutIn(t, b.y, c.y, d)) 169 | 170 | class Quint: 171 | 172 | static func EaseIn(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 173 | return Vector2(Easing.Quint.EaseIn(t, b.x, c.x, d), Easing.Quint.EaseIn(t, b.y, c.y, d)) 174 | 175 | static func EaseOut(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 176 | return Vector2(Easing.Quint.EaseOut(t, b.x, c.x, d), Easing.Quint.EaseOut(t, b.y, c.y, d)) 177 | 178 | static func EaseInOut(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 179 | return Vector2(Easing.Quint.EaseInOut(t, b.x, c.x, d), Easing.Quint.EaseInOut(t, b.y, c.y, d)) 180 | 181 | static func EaseOutIn(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 182 | return Vector2(Easing.Quint.EaseOutIn(t, b.x, c.x, d), Easing.Quint.EaseOutIn(t, b.y, c.y, d)) 183 | 184 | class Sine: 185 | 186 | static func EaseIn(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 187 | return Vector2(Easing.Sine.EaseIn(t, b.x, c.x, d), Easing.Sine.EaseIn(t, b.y, c.y, d)) 188 | 189 | static func EaseOut(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 190 | return Vector2(Easing.Sine.EaseOut(t, b.x, c.x, d), Easing.Sine.EaseOut(t, b.y, c.y, d)) 191 | 192 | static func EaseInOut(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 193 | return Vector2(Easing.Sine.EaseInOut(t, b.x, c.x, d), Easing.Sine.EaseInOut(t, b.y, c.y, d)) 194 | 195 | static func EaseOutIn(t: float, b: Vector2, c: Vector2, d: float) -> Vector2: 196 | return Vector2(Easing.Sine.EaseOutIn(t, b.x, c.x, d), Easing.Sine.EaseOutIn(t, b.y, c.y, d)) 197 | -------------------------------------------------------------------------------- /EasingFunctions.gd: -------------------------------------------------------------------------------- 1 | #Terms of Use: Easing Functions (Equations) 2 | # 3 | #Open source under the MIT License and the 3-Clause BSD License. 4 | # 5 | # 6 | #MIT License 7 | # 8 | #Copyright © 2001 Robert Penner 9 | # 10 | #Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 11 | # 12 | #The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13 | # 14 | #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | # 16 | # 17 | #BSD License 18 | # 19 | #Copyright © 2001 Robert Penner 20 | # 21 | #Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 22 | # 23 | #Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 24 | #Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 25 | #Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. 26 | # 27 | #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE, DATA, OR PROFITS OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | # easing functions 30 | 31 | # t = elapsed time 32 | # b = begin 33 | # c = change = ending - beginning 34 | # d = duration 35 | 36 | # easing function make a value change from "b" to "b + c" 37 | # in time from "t = 0" to "t = t + d" 38 | 39 | class_name Easing 40 | 41 | class Back: 42 | # s = amplitude for "back" variation 43 | static func EaseIn(t: float, b: float, c: float, d: float, s: float = 1.70158) -> float: 44 | t = t / d 45 | return c * t * t * ((s + 1) * t - s) + b 46 | 47 | static func EaseOut(t: float, b: float, c: float, d: float, s: float = 1.70158) -> float: 48 | t = t / d - 1 49 | return c * (t * t * ((s + 1) * t + s) + 1) + b 50 | 51 | static func EaseInOut(t: float, b: float, c: float, d: float, s: float = 1.70158) -> float: 52 | t = t / d * 2 53 | s = s * 1.525 54 | if t < 1: 55 | return c / 2 * (t * t * ((s + 1) * t - s)) + b 56 | t = t - 2 57 | return c / 2 * (t * t * ((s + 1) * t + s) + 2) + b 58 | 59 | static func EaseOutIn(t: float, b: float, c: float, d: float, s: float = 1.70158) -> float: 60 | return EaseOut(t * 2, b, c / 2, d, s) if t < d / 2 else EaseIn((t * 2) - d, b + c / 2, c / 2, d, s) 61 | 62 | class Bounce: 63 | 64 | static func EaseOut(t: float, b: float, c: float, d: float) -> float: 65 | t = t / d 66 | if t < 1 / 2.75: 67 | return c * (7.5625 * t * t) + b 68 | elif t < 2 / 2.75: 69 | t = t - (1.5 / 2.75) 70 | return c * (7.5625 * t * t + 0.75) + b 71 | elif t < 2.5 / 2.75: 72 | t = t - (2.25 / 2.75) 73 | return c * (7.5625 * t * t + 0.9375) + b 74 | else: 75 | t = t - (2.625 / 2.75) 76 | return c * (7.5625 * t * t + 0.984375) + b 77 | 78 | static func EaseIn(t: float, b: float, c: float, d: float) -> float: 79 | return c - EaseOut(d-t, 0, c, d) + b 80 | 81 | static func EaseInOut(t: float, b: float, c: float, d: float) -> float: 82 | if (t < d/2): 83 | return EaseIn(t*2, 0, c, d) * 0.5 + b 84 | else: 85 | return EaseOut(t*2-d, 0, c, d) * 0.5 + c*0.5 + b 86 | 87 | static func EaseOutIn(t: float, b: float, c: float, d: float) -> float: 88 | return EaseOut(t * 2, b, c / 2, d) if t < d / 2 else EaseIn((t * 2) - d, b + c / 2, c / 2, d) 89 | 90 | class Circ: 91 | 92 | static func EaseIn(t: float, b: float, c: float, d: float) -> float: 93 | t = t / d 94 | return -c * (sqrt(1 - t * t) - 1) + b 95 | 96 | static func EaseOut(t: float, b: float, c: float, d: float) -> float: 97 | t = t / d - 1 98 | return c * sqrt(1 - t * t) + b 99 | 100 | static func EaseInOut(t: float, b: float, c: float, d: float) -> float: 101 | t = t / d * 2 102 | if t < 1: 103 | return -c / 2 * (sqrt(1 - t * t) - 1) + b 104 | t = t - 2 105 | return c / 2 * (sqrt(1 - t * t) + 1) + b 106 | 107 | static func EaseOutIn(t: float, b: float, c: float, d: float) -> float: 108 | return EaseOut(t * 2, b, c / 2, d) if t < d / 2 else EaseIn((t * 2) - d, b + c / 2, c / 2, d) 109 | 110 | class Cubic: 111 | 112 | static func EaseIn(t: float, b: float, c: float, d: float) -> float: 113 | t = t / d 114 | return c * t * t * t + b 115 | 116 | static func EaseOut(t: float, b: float, c: float, d: float) -> float: 117 | t = t / d - 1 118 | return c * (t * t * t + 1) + b 119 | 120 | static func EaseInOut(t: float, b: float, c: float, d: float) -> float: 121 | t = t / d * 2 122 | if t < 1: 123 | return c / 2 * t * t * t + b 124 | t = t - 2 125 | return c / 2 * (t * t * t + 2) + b 126 | 127 | static func EaseOutIn(t: float, b: float, c: float, d: float) -> float: 128 | return EaseOut(t * 2, b, c / 2, d) if t < d / 2 else EaseIn((t * 2) - d, b + c / 2, c / 2, d) 129 | 130 | class Elastic: 131 | # a = amplitude; p = period 132 | static func EaseIn(t: float, b: float, c: float, d: float, a: float = 0, p: float = 0) -> float: 133 | if t == 0: 134 | return b 135 | t = t / d 136 | if t == 1: 137 | return b + c 138 | 139 | if p == 0: 140 | p = d * 0.3 141 | 142 | var s: float 143 | if a == 0 or a < abs(c): 144 | a = c 145 | s = p / 4 146 | else: 147 | s = p / (2 * PI) * asin(c / a) 148 | 149 | t = t - 1 150 | return -(a * pow(2, 10 * t) * sin((t * d - s) * (2 * PI) / p)) + b 151 | 152 | static func EaseOut(t: float, b: float, c: float, d: float, a: float = 0, p: float = 0) -> float: 153 | if t == 0: 154 | return b 155 | t = t / d 156 | if t == 1: 157 | return b + c 158 | 159 | if p == 0: 160 | p = d * 0.3 161 | 162 | var s: float 163 | if a == 0: 164 | a = c 165 | s = p / 4 166 | else: 167 | s = p / (2 * PI) * asin(c / a) 168 | 169 | return a * pow(2, -10 * t) * sin((t * d - s) * (2 * PI) / p) + c + b 170 | 171 | static func EaseInOut(t: float, b: float, c: float, d: float, a: float = 0, p: float = 0) -> float: 172 | if t == 0: 173 | return b 174 | t = t / d * 2 175 | if t == 2: 176 | return b + c 177 | 178 | if p == 0: 179 | p = d * 0.3 * 1.5 180 | 181 | var s: float 182 | if a == 0 or a < abs(c): 183 | a = c 184 | s = p / 4 185 | else: 186 | s = p / (2 * PI) * asin( c / a) 187 | 188 | if t < 1: 189 | t = t - 1 190 | return -0.5 * (a * pow(2, 10 * t) * sin((t * d - s) * (2 * PI) / p)) + b 191 | else: 192 | t = t - 1 193 | return a * pow(2, -10 * t) * sin((t * d - s) * (2 * PI) / p ) * 0.5 + c + b 194 | 195 | static func EaseOutIn(t: float, b: float, c: float, d: float, a: float = 0, p: float = 0) -> float: 196 | return EaseOut(t * 2, b, c / 2, d, a, p) if t < d / 2 else EaseIn((t * 2) - d, b + c / 2, c / 2, d, a, p) 197 | 198 | 199 | class Expo: 200 | 201 | static func EaseIn(t: float, b: float, c: float, d: float) -> float: 202 | return b if t==d else c * pow(2, 10 * (t / d - 1)) + b - c * 0.001 203 | 204 | static func EaseOut(t: float, b: float, c: float, d: float) -> float: 205 | return b + c if t==d else c * 1.001 * (-pow(2, -10 * t / d) + 1) + b 206 | 207 | static func EaseInOut(t: float, b: float, c: float, d: float) -> float: 208 | if (t==0): 209 | return b 210 | if (t==d): 211 | return b+c 212 | t = t / d * 2 213 | if t < 1: 214 | return c / 2 * pow(2, 10 * (t - 1)) + b - c * 0.0005 215 | t = t - 1 216 | return c / 2 * 1.0005 * (-pow(2, -10 * t) + 2) + b 217 | 218 | static func EaseOutIn(t: float, b: float, c: float, d: float) -> float: 219 | return EaseOut(t * 2, b, c / 2, d) if t < d / 2 else EaseIn((t * 2) - d, b + c / 2, c / 2, d) 220 | 221 | class Linear: 222 | 223 | static func EaseNone(t: float, b: float, c: float, d: float) -> float: 224 | return c * t / d + b 225 | 226 | static func EaseIn(t: float, b: float, c: float, d: float) -> float: 227 | return c * t / d + b 228 | 229 | static func EaseOut(t: float, b: float, c: float, d: float) -> float: 230 | return c * t / d + b 231 | 232 | static func EaseInOut(t: float, b: float, c: float, d: float) -> float: 233 | return c * t / d + b 234 | 235 | static func EaseOutIn(t: float, b: float, c: float, d: float) -> float: 236 | return c * t / d + b 237 | 238 | class Quad: 239 | 240 | static func EaseIn(t: float, b: float, c: float, d: float) -> float: 241 | t = t / d 242 | return c * t * t + b 243 | 244 | static func EaseOut(t: float, b: float, c: float, d: float) -> float: 245 | t = t / d 246 | return -c * t * (t - 2) + b 247 | 248 | static func EaseInOut(t: float, b: float, c: float, d: float) -> float: 249 | t = t / d * 2 250 | return c / 2 * t * t + b if t < 1 else -c / 2 * ((t - 1) * (t - 3) - 1) + b 251 | 252 | static func EaseOutIn(t: float, b: float, c: float, d: float) -> float: 253 | return EaseOut(t * 2, b, c / 2, d) if t < d / 2 else EaseIn((t * 2) - d, b + c / 2, c / 2, d) 254 | 255 | class Quart: 256 | 257 | static func EaseIn(t: float, b: float, c: float, d: float) -> float: 258 | t = t / d 259 | return c * t * t * t * t + b 260 | 261 | static func EaseOut(t: float, b: float, c: float, d: float) -> float: 262 | t = t / d - 1 263 | return -c * (t * t * t * t - 1) + b 264 | 265 | static func EaseInOut(t: float, b: float, c: float, d: float) -> float: 266 | t = t / d * 2 267 | if t < 1: 268 | return c / 2 * t * t * t * t + b 269 | else: 270 | t = t - 2 271 | return -c / 2 * (t * t * t * t - 2) + b 272 | 273 | static func EaseOutIn(t: float, b: float, c: float, d: float) -> float: 274 | return EaseOut(t * 2, b, c / 2, d) if t < d / 2 else EaseIn((t * 2) - d, b + c / 2, c / 2, d) 275 | 276 | class Quint: 277 | 278 | static func EaseIn(t: float, b: float, c: float, d: float) -> float: 279 | t = t / d 280 | return c * t * t * t * t * t + b 281 | 282 | static func EaseOut(t: float, b: float, c: float, d: float) -> float: 283 | t = t / d - 1 284 | return c*(t * t * t * t * t + 1) + b 285 | 286 | static func EaseInOut(t: float, b: float, c: float, d: float) -> float: 287 | t = t / d * 2 288 | if t < 1: 289 | return c / 2 * t * t * t * t * t + b 290 | else: 291 | t = t - 2 292 | return c / 2 * (t * t * t * t * t + 2) + b 293 | 294 | static func EaseOutIn(t: float, b: float, c: float, d: float) -> float: 295 | return EaseOut(t * 2, b, c / 2, d) if t < d / 2 else EaseIn((t * 2) - d, b + c / 2, c / 2, d) 296 | 297 | class Sine: 298 | 299 | static func EaseIn(t: float, b: float, c: float, d: float) -> float: 300 | return -c * cos(t/d * (PI/2)) + c + b 301 | 302 | static func EaseOut(t: float, b: float, c: float, d: float) -> float: 303 | return c * sin(t/d * (PI/2)) + b 304 | 305 | static func EaseInOut(t: float, b: float, c: float, d: float) -> float: 306 | return -c/2 * (cos(PI*t/d) - 1) + b 307 | 308 | static func EaseOutIn(t: float, b: float, c: float, d: float) -> float: 309 | return EaseOut(t * 2, b, c / 2, d) if t < d / 2 else EaseIn((t * 2) -d, b + c / 2, c / 2, d) 310 | -------------------------------------------------------------------------------- /EasingFunctions_V3.gd: -------------------------------------------------------------------------------- 1 | #Terms of Use: Easing Functions (Equations) 2 | # 3 | #Open source under the MIT License and the 3-Clause BSD License. 4 | # 5 | # 6 | #MIT License 7 | # 8 | #Copyright © 2001 Robert Penner 9 | # 10 | #Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 11 | # 12 | #The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13 | # 14 | #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | # 16 | # 17 | #BSD License 18 | # 19 | #Copyright © 2001 Robert Penner 20 | # 21 | #Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 22 | # 23 | #Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 24 | #Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 25 | #Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. 26 | # 27 | #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE, DATA, OR PROFITS OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | # easing functions 30 | 31 | # t = elapsed time 32 | # b = begin 33 | # c = change = ending - beginning 34 | # d = duration 35 | 36 | # easing function make a value change from "b" to "b + c" 37 | # in time from "t = 0" to "t = t + d" 38 | 39 | class_name EasingV3 40 | 41 | class Back: 42 | # s = amplitude for "back" variation 43 | static func EaseIn(t: float, b: Vector3, c: Vector3, d: float, s: float = 1.70158) -> Vector3: 44 | return Vector3(Easing.Back.EaseIn(t, b.x, c.x, d, s), Easing.Back.EaseIn(t, b.y, c.y, d, s), Easing.Back.EaseIn(t, b.z, c.z, d, s)) 45 | 46 | static func EaseOut(t: float, b: Vector3, c: Vector3, d: float, s: float = 1.70158) -> Vector3: 47 | return Vector3(Easing.Back.EaseOut(t, b.x, c.x, d, s), Easing.Back.EaseOut(t, b.y, c.y, d, s), Easing.Back.EaseOut(t, b.z, c.z, d, s)) 48 | 49 | static func EaseInOut(t: float, b: Vector3, c: Vector3, d: float, s: float = 1.70158) -> Vector3: 50 | return Vector3(Easing.Back.EaseInOut(t, b.x, c.x, d, s), Easing.Back.EaseInOut(t, b.y, c.y, d, s), Easing.Back.EaseInOut(t, b.z, c.z, d, s)) 51 | 52 | static func EaseOutIn(t: float, b: Vector3, c: Vector3, d: float, s: float = 1.70158) -> Vector3: 53 | return Vector3(Easing.Back.EaseOutIn(t, b.x, c.x, d, s), Easing.Back.EaseOutIn(t, b.y, c.y, d, s), Easing.Back.EaseOutIn(t, b.z, c.z, d, s)) 54 | 55 | class Bounce: 56 | 57 | static func EaseOut(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 58 | return Vector3(Easing.Bounce.EaseOut(t, b.x, c.x, d), Easing.Bounce.EaseOut(t, b.y, c.y, d), Easing.Bounce.EaseOut(t, b.z, c.z, d)) 59 | 60 | static func EaseIn(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 61 | return Vector3(Easing.Bounce.EaseIn(t, b.x, c.x, d), Easing.Bounce.EaseIn(t, b.y, c.y, d), Easing.Bounce.EaseIn(t, b.z, c.z, d)) 62 | 63 | static func EaseInOut(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 64 | return Vector3(Easing.Bounce.EaseInOut(t, b.x, c.x, d), Easing.Bounce.EaseInOut(t, b.y, c.y, d), Easing.Bounce.EaseInOut(t, b.z, c.z, d)) 65 | 66 | static func EaseOutIn(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 67 | return Vector3(Easing.Bounce.EaseOutIn(t, b.x, c.x, d), Easing.Bounce.EaseOutIn(t, b.y, c.y, d), Easing.Bounce.EaseOutIn(t, b.z, c.z, d)) 68 | 69 | class Circ: 70 | 71 | static func EaseIn(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 72 | return Vector3(Easing.Circ.EaseIn(t, b.x, c.x, d), Easing.Circ.EaseIn(t, b.y, c.y, d), Easing.Circ.EaseIn(t, b.z, c.z, d)) 73 | 74 | static func EaseOut(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 75 | return Vector3(Easing.Circ.EaseOut(t, b.x, c.x, d), Easing.Circ.EaseOut(t, b.y, c.y, d), Easing.Circ.EaseOut(t, b.z, c.z, d)) 76 | 77 | static func EaseInOut(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 78 | return Vector3(Easing.Circ.EaseInOut(t, b.x, c.x, d), Easing.Circ.EaseInOut(t, b.y, c.y, d), Easing.Circ.EaseInOut(t, b.z, c.z, d)) 79 | 80 | static func EaseOutIn(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 81 | return Vector3(Easing.Circ.EaseOutIn(t, b.x, c.x, d), Easing.Circ.EaseOutIn(t, b.y, c.y, d), Easing.Circ.EaseOutIn(t, b.z, c.z, d)) 82 | 83 | class Cubic: 84 | 85 | static func EaseIn(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 86 | return Vector3(Easing.Cubic.EaseIn(t, b.x, c.x, d), Easing.Cubic.EaseIn(t, b.y, c.y, d), Easing.Cubic.EaseIn(t, b.z, c.z, d)) 87 | 88 | static func EaseOut(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 89 | return Vector3(Easing.Cubic.EaseOut(t, b.x, c.x, d), Easing.Cubic.EaseOut(t, b.y, c.y, d), Easing.Cubic.EaseOut(t, b.z, c.z, d)) 90 | 91 | static func EaseInOut(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 92 | return Vector3(Easing.Cubic.EaseInOut(t, b.x, c.x, d), Easing.Cubic.EaseInOut(t, b.y, c.y, d), Easing.Cubic.EaseInOut(t, b.z, c.z, d)) 93 | 94 | static func EaseOutIn(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 95 | return Vector3(Easing.Cubic.EaseOutIn(t, b.x, c.x, d), Easing.Cubic.EaseOutIn(t, b.y, c.y, d), Easing.Cubic.EaseOutIn(t, b.z, c.z, d)) 96 | 97 | class Elastic: 98 | # a = amplitude; p = period 99 | static func EaseIn(t: float, b: Vector3, c: Vector3, d: float, a: float = 0, p: float = 0) -> Vector3: 100 | return Vector3(Easing.Elastic.EaseIn(t, b.x, c.x, d, a, p), Easing.Elastic.EaseIn(t, b.y, c.y, d, a, p), Easing.Elastic.EaseIn(t, b.z, c.z, d, a, p)) 101 | 102 | static func EaseOut(t: float, b: Vector3, c: Vector3, d: float, a: float = 0, p: float = 0) -> Vector3: 103 | return Vector3(Easing.Elastic.EaseOut(t, b.x, c.x, d, a, p), Easing.Elastic.EaseOut(t, b.y, c.y, d, a, p), Easing.Elastic.EaseOut(t, b.z, c.z, d, a, p)) 104 | 105 | static func EaseInOut(t: float, b: Vector3, c: Vector3, d: float, a: float = 0, p: float = 0) -> Vector3: 106 | return Vector3(Easing.Elastic.EaseInOut(t, b.x, c.x, d, a, p), Easing.Elastic.EaseInOut(t, b.y, c.y, d, a, p), Easing.Elastic.EaseInOut(t, b.z, c.z, d, a, p)) 107 | 108 | static func EaseOutIn(t: float, b: Vector3, c: Vector3, d: float, a: float = 0, p: float = 0) -> Vector3: 109 | return Vector3(Easing.Elastic.EaseOutIn(t, b.x, c.x, d, a, p), Easing.Elastic.EaseOutIn(t, b.y, c.y, d, a, p), Easing.Elastic.EaseOutIn(t, b.z, c.z, d, a, p)) 110 | 111 | class Expo: 112 | 113 | static func EaseIn(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 114 | return Vector3(Easing.Expo.EaseIn(t, b.x, c.x, d), Easing.Expo.EaseIn(t, b.y, c.y, d), Easing.Expo.EaseIn(t, b.z, c.z, d)) 115 | 116 | static func EaseOut(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 117 | return Vector3(Easing.Expo.EaseOut(t, b.x, c.x, d), Easing.Expo.EaseOut(t, b.y, c.y, d), Easing.Expo.EaseOut(t, b.z, c.z, d)) 118 | 119 | static func EaseInOut(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 120 | return Vector3(Easing.Expo.EaseInOut(t, b.x, c.x, d), Easing.Expo.EaseInOut(t, b.y, c.y, d), Easing.Expo.EaseInOut(t, b.z, c.z, d)) 121 | 122 | static func EaseOutIn(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 123 | return Vector3(Easing.Expo.EaseOutIn(t, b.x, c.x, d), Easing.Expo.EaseOutIn(t, b.y, c.y, d), Easing.Expo.EaseOutIn(t, b.z, c.z, d)) 124 | 125 | class Linear: 126 | 127 | static func EaseNone(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 128 | return Vector3(Easing.Linear.EaseIn(t, b.x, c.x, d), Easing.Linear.EaseIn(t, b.y, c.y, d), Easing.Linear.EaseNone(t, b.z, c.z, d)) 129 | 130 | static func EaseIn(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 131 | return Vector3(Easing.Linear.EaseIn(t, b.x, c.x, d), Easing.Linear.EaseIn(t, b.y, c.y, d), Easing.Linear.EaseIn(t, b.z, c.z, d)) 132 | 133 | static func EaseOut(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 134 | return Vector3(Easing.Linear.EaseOut(t, b.x, c.x, d), Easing.Linear.EaseOut(t, b.y, c.y, d), Easing.Linear.EaseOut(t, b.z, c.z, d)) 135 | 136 | static func EaseInOut(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 137 | return Vector3(Easing.Linear.EaseInOut(t, b.x, c.x, d), Easing.Linear.EaseInOut(t, b.y, c.y, d), Easing.Linear.EaseInOut(t, b.z, c.z, d)) 138 | 139 | static func EaseOutIn(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 140 | return Vector3(Easing.Linear.EaseOutIn(t, b.x, c.x, d), Easing.Linear.EaseOutIn(t, b.y, c.y, d), Easing.Linear.EaseOutIn(t, b.z, c.z, d)) 141 | 142 | class Quad: 143 | 144 | static func EaseIn(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 145 | return Vector3(Easing.Quad.EaseIn(t, b.x, c.x, d), Easing.Quad.EaseIn(t, b.y, c.y, d), Easing.Quad.EaseIn(t, b.z, c.z, d)) 146 | 147 | static func EaseOut(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 148 | return Vector3(Easing.Quad.EaseOut(t, b.x, c.x, d), Easing.Quad.EaseOut(t, b.y, c.y, d), Easing.Quad.EaseOut(t, b.z, c.z, d)) 149 | 150 | static func EaseInOut(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 151 | return Vector3(Easing.Quad.EaseInOut(t, b.x, c.x, d), Easing.Quad.EaseInOut(t, b.y, c.y, d), Easing.Quad.EaseInOut(t, b.z, c.z, d)) 152 | 153 | static func EaseOutIn(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 154 | return Vector3(Easing.Quad.EaseOutIn(t, b.x, c.x, d), Easing.Quad.EaseOutIn(t, b.y, c.y, d), Easing.Quad.EaseOutIn(t, b.z, c.z, d)) 155 | 156 | class Quart: 157 | 158 | static func EaseIn(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 159 | return Vector3(Easing.Quart.EaseIn(t, b.x, c.x, d), Easing.Quart.EaseIn(t, b.y, c.y, d), Easing.Quart.EaseIn(t, b.z, c.z, d)) 160 | 161 | static func EaseOut(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 162 | return Vector3(Easing.Quart.EaseOut(t, b.x, c.x, d), Easing.Quart.EaseOut(t, b.y, c.y, d), Easing.Quart.EaseOut(t, b.z, c.z, d)) 163 | 164 | static func EaseInOut(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 165 | return Vector3(Easing.Quart.EaseInOut(t, b.x, c.x, d), Easing.Quart.EaseInOut(t, b.y, c.y, d), Easing.Quart.EaseInOut(t, b.z, c.z, d)) 166 | 167 | static func EaseOutIn(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 168 | return Vector3(Easing.Quart.EaseOutIn(t, b.x, c.x, d), Easing.Quart.EaseOutIn(t, b.y, c.y, d), Easing.Quart.EaseOutIn(t, b.z, c.z, d)) 169 | 170 | class Quint: 171 | 172 | static func EaseIn(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 173 | return Vector3(Easing.Quint.EaseIn(t, b.x, c.x, d), Easing.Quint.EaseIn(t, b.y, c.y, d), Easing.Quint.EaseIn(t, b.z, c.z, d)) 174 | 175 | static func EaseOut(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 176 | return Vector3(Easing.Quint.EaseOut(t, b.x, c.x, d), Easing.Quint.EaseOut(t, b.y, c.y, d), Easing.Quint.EaseOut(t, b.z, c.z, d)) 177 | 178 | static func EaseInOut(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 179 | return Vector3(Easing.Quint.EaseInOut(t, b.x, c.x, d), Easing.Quint.EaseInOut(t, b.y, c.y, d), Easing.Quint.EaseInOut(t, b.z, c.z, d)) 180 | 181 | static func EaseOutIn(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 182 | return Vector3(Easing.Quint.EaseOutIn(t, b.x, c.x, d), Easing.Quint.EaseOutIn(t, b.y, c.y, d), Easing.Quint.EaseOutIn(t, b.z, c.z, d)) 183 | 184 | class Sine: 185 | 186 | static func EaseIn(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 187 | return Vector3(Easing.Sine.EaseIn(t, b.x, c.x, d), Easing.Sine.EaseIn(t, b.y, c.y, d), Easing.Sine.EaseIn(t, b.z, c.z, d)) 188 | 189 | static func EaseOut(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 190 | return Vector3(Easing.Sine.EaseOut(t, b.x, c.x, d), Easing.Sine.EaseOut(t, b.y, c.y, d), Easing.Sine.EaseOut(t, b.z, c.z, d)) 191 | 192 | static func EaseInOut(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 193 | return Vector3(Easing.Sine.EaseInOut(t, b.x, c.x, d), Easing.Sine.EaseInOut(t, b.y, c.y, d), Easing.Sine.EaseInOut(t, b.z, c.z, d)) 194 | 195 | static func EaseOutIn(t: float, b: Vector3, c: Vector3, d: float) -> Vector3: 196 | return Vector3(Easing.Sine.EaseOutIn(t, b.x, c.x, d), Easing.Sine.EaseOutIn(t, b.y, c.y, d), Easing.Sine.EaseOutIn(t, b.z, c.z, d)) 197 | --------------------------------------------------------------------------------