* Makes any easing function symmetrical. The easing function will run * forwards for half of the duration, then backwards for the rest of the * duration.
(
easing: (t: number) => number,
)
| 253 | * duration. |
| 254 | */ |
| 255 | static inOut( |
| 256 | easing: (t: number) => number, |
| 257 | ): (t: number) => number { |
| 258 | return (t) => { |
| 259 | if (t < 0.5) { |
| 260 | return easing(t * 2) / 2; |
| 261 | } |
| 262 | return 1 - easing((1 - t) * 2) / 2; |
| 263 | }; |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | module.exports = Easing; |
no outgoing calls
no test coverage detected