Easings.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  1. /************************************************************************
  2. * Easings.js
  3. ************************************************************************
  4. * Copyright (c) 2021 Pedro Tonini Rosenberg Schneider.
  5. *
  6. * This file is part of Pandora.
  7. *
  8. * Pandora is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * Pandora is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with Pandora. If not, see <https://www.gnu.org/licenses/>.
  20. *************************************************************************/
  21. /**
  22. *
  23. * Derived from Robert Penner's easing equations: http://robertpenner.com/easing/
  24. * The original copyright notice is as follows:
  25. *
  26. * TERMS OF USE - EASING EQUATIONS
  27. *
  28. * Open source under the BSD License.
  29. *
  30. * Copyright © 2001 Robert Penner
  31. * All rights reserved.
  32. *
  33. * Redistribution and use in source and binary forms, with or without modification,
  34. * are permitted provided that the following conditions are met:
  35. *
  36. * Redistributions of source code must retain the above copyright notice, this list of
  37. * conditions and the following disclaimer.
  38. * Redistributions in binary form must reproduce the above copyright notice, this list
  39. * of conditions and the following disclaimer in the documentation and/or other materials
  40. * provided with the distribution.
  41. *
  42. * Neither the name of the author nor the names of contributors may be used to endorse
  43. * or promote products derived from this software without specific prior written permission.
  44. *
  45. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
  46. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  47. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  48. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  49. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  50. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  51. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  52. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  53. * OF THE POSSIBILITY OF SUCH DAMAGE.
  54. *
  55. */
  56. /**
  57. * This {@code Easings} singleton provides an interface for the engine to utilize
  58. * various easing equations. Used mostly on the Tween GameObject. User can access this
  59. * API, but it is not recomended; try using tweens instead.
  60. *
  61. * @author Pedro Schneider
  62. *
  63. * @namespace
  64. */
  65. const Easings = {
  66. // * See https://easings.net/ for more details on each type of easing.
  67. /**
  68. * Namespace to separate linear easing equations.
  69. *
  70. * @namespace
  71. */
  72. Linear:
  73. {
  74. /**
  75. * Calculates a linear easing.
  76. *
  77. * @param {number} t current time of the easing process.
  78. * @param {number} b beginning value of the esasing process.
  79. * @param {number} c change in vlaue during the easing process.
  80. * @param {number} d total duration of the easing process.
  81. *
  82. * @returns {number} current value in the easing process.
  83. */
  84. ease: function(t, b, c, d)
  85. {
  86. return b + (c * t / d);
  87. }
  88. },
  89. /**
  90. * Namespace to separate quadratic easing equations.
  91. *
  92. * @namespace
  93. */
  94. Quad:
  95. {
  96. /**
  97. * Calculates a quadratic ease-in.
  98. *
  99. * @param {number} t current time of the easing process.
  100. * @param {number} b beginning value of the esasing process.
  101. * @param {number} c change in vlaue during the easing process.
  102. * @param {number} d total duration of the easing process.
  103. *
  104. * @returns {number} current value in the easing process.
  105. */
  106. easeIn: function(t, b, c, d)
  107. {
  108. return c * (t /= d) * t + b;
  109. },
  110. /**
  111. * Calculates a quadratic ease-out.
  112. *
  113. * @param {number} t current time of the easing process.
  114. * @param {number} b beginning value of the esasing process.
  115. * @param {number} c change in vlaue during the easing process.
  116. * @param {number} d total duration of the easing process.
  117. *
  118. * @returns {number} current value in the easing process.
  119. */
  120. easeOut: function(t, b, c, d)
  121. {
  122. return -c * (t /= d) * (t - 2) + b;
  123. },
  124. /**
  125. * Calculates a quadratic ease-in and out.
  126. *
  127. * @param {number} t current time of the easing process.
  128. * @param {number} b beginning value of the esasing process.
  129. * @param {number} c change in vlaue during the easing process.
  130. * @param {number} d total duration of the easing process.
  131. *
  132. * @returns {number} current value in the easing process.
  133. */
  134. easeInOut: function(t, b, c, d)
  135. {
  136. if ((t /= d / 2) < 1) return c / 2 * t * t + b;
  137. return -c / 2 * ((--t) * (t - 2) - 1) + b;
  138. }
  139. },
  140. /**
  141. * Namespace to separate cubic easing equations.
  142. *
  143. * @namespace
  144. */
  145. Cubic:
  146. {
  147. /**
  148. * Calculates a cubic ease-in.
  149. *
  150. * @param {number} t current time of the easing process.
  151. * @param {number} b beginning value of the esasing process.
  152. * @param {number} c change in vlaue during the easing process.
  153. * @param {number} d total duration of the easing process.
  154. *
  155. * @returns {number} current value in the easing process.
  156. */
  157. easeIn: function(t, b, c, d)
  158. {
  159. return c * (t /= d) * t * t + b;
  160. },
  161. /**
  162. * Calculates a cubic ease-out.
  163. *
  164. * @param {number} t current time of the easing process.
  165. * @param {number} b beginning value of the esasing process.
  166. * @param {number} c change in vlaue during the easing process.
  167. * @param {number} d total duration of the easing process.
  168. *
  169. * @returns {number} current value in the easing process.
  170. */
  171. easeOut: function(t, b, c, d)
  172. {
  173. return c * ((t = t / d - 1) * t * t + 1) + b;
  174. },
  175. /**
  176. * Calculates a cubic ease-in and out.
  177. *
  178. * @param {number} t current time of the easing process.
  179. * @param {number} b beginning value of the esasing process.
  180. * @param {number} c change in vlaue during the easing process.
  181. * @param {number} d total duration of the easing process.
  182. *
  183. * @returns {number} current value in the easing process.
  184. */
  185. easeInOut: function(t, b, c, d)
  186. {
  187. if ((t /= d / 2) < 1) return c / 2 * t * t * t + b;
  188. return c / 2 * ((t -= 2) * t * t + 2) + b;
  189. }
  190. },
  191. /**
  192. * Namespace to separate quartic easing equations.
  193. *
  194. * @namespace
  195. */
  196. Quart:
  197. {
  198. /**
  199. * Calculates a quartic ease-in.
  200. *
  201. * @param {number} t current time of the easing process.
  202. * @param {number} b beginning value of the esasing process.
  203. * @param {number} c change in vlaue during the easing process.
  204. * @param {number} d total duration of the easing process.
  205. *
  206. * @returns {number} current value in the easing process.
  207. */
  208. easeIn: function(t, b, c, d)
  209. {
  210. return c * (t /= d) * t * t * t + b;
  211. },
  212. /**
  213. * Calculates a quartic ease-out.
  214. *
  215. * @param {number} t current time of the easing process.
  216. * @param {number} b beginning value of the esasing process.
  217. * @param {number} c change in vlaue during the easing process.
  218. * @param {number} d total duration of the easing process.
  219. *
  220. * @returns {number} current value in the easing process.
  221. */
  222. easeOut: function(t, b, c, d)
  223. {
  224. return -c * ((t = t / d - 1) * t * t * t - 1) + b;
  225. },
  226. /**
  227. * Calculates a quartic ease-in and out.
  228. *
  229. * @param {number} t current time of the easing process.
  230. * @param {number} b beginning value of the esasing process.
  231. * @param {number} c change in vlaue during the easing process.
  232. * @param {number} d total duration of the easing process.
  233. *
  234. * @returns {number} current value in the easing process.
  235. */
  236. easeInOut: function(t, b, c, d)
  237. {
  238. if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b;
  239. return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
  240. }
  241. },
  242. /**
  243. * Namespace to separate quintic easing equations.
  244. *
  245. * @namespace
  246. */
  247. Quint:
  248. {
  249. /**
  250. * Calculates a quintic ease-in.
  251. *
  252. * @param {number} t current time of the easing process.
  253. * @param {number} b beginning value of the esasing process.
  254. * @param {number} c change in vlaue during the easing process.
  255. * @param {number} d total duration of the easing process.
  256. *
  257. * @returns {number} current value in the easing process.
  258. */
  259. easeIn: function(t, b, c, d)
  260. {
  261. return c * (t /= d) * t * t * t * t + b;
  262. },
  263. /**
  264. * Calculates a quintic ease-out.
  265. *
  266. * @param {number} t current time of the easing process.
  267. * @param {number} b beginning value of the esasing process.
  268. * @param {number} c change in vlaue during the easing process.
  269. * @param {number} d total duration of the easing process.
  270. *
  271. * @returns {number} current value in the easing process.
  272. */
  273. easeOut: function(t, b, c, d)
  274. {
  275. return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
  276. },
  277. /**
  278. * Calculates a quintic ease-in and out.
  279. *
  280. * @param {number} t current time of the easing process.
  281. * @param {number} b beginning value of the esasing process.
  282. * @param {number} c change in vlaue during the easing process.
  283. * @param {number} d total duration of the easing process.
  284. *
  285. * @returns {number} current value in the easing process.
  286. */
  287. easeInOut: function(t, b, c, d)
  288. {
  289. if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b;
  290. return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
  291. }
  292. },
  293. /**
  294. * Namespace to separate senoidal easing equations.
  295. *
  296. * @namespace
  297. */
  298. Sine:
  299. {
  300. /**
  301. * Calculates a senoidal ease-in;
  302. *
  303. * @param {number} t current time of the easing process.
  304. * @param {number} b beginning value of the esasing process.
  305. * @param {number} c change in vlaue during the easing process.
  306. * @param {number} d total duration of the easing process.
  307. *
  308. * @returns {number} current value in the easing process.
  309. */
  310. easeIn: function(t, b, c, d)
  311. {
  312. return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
  313. },
  314. /**
  315. * Calculates a senoidal ease-out.
  316. *
  317. * @param {number} t current time of the easing process.
  318. * @param {number} b beginning value of the esasing process.
  319. * @param {number} c change in vlaue during the easing process.
  320. * @param {number} d total duration of the easing process.
  321. *
  322. * @returns {number} current value in the easing process.
  323. */
  324. easeOut: function(t, b, c, d)
  325. {
  326. return c * Math.sin(t / d * (Math.PI / 2)) + b;
  327. },
  328. /**
  329. * Calculates a senoidal ease-in and out.
  330. *
  331. * @param {number} t current time of the easing process.
  332. * @param {number} b beginning value of the esasing process.
  333. * @param {number} c change in vlaue during the easing process.
  334. * @param {number} d total duration of the easing process.
  335. *
  336. * @returns {number} current value in the easing process.
  337. */
  338. easeInOut: function(t, b, c, d)
  339. {
  340. return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
  341. }
  342. },
  343. /**
  344. * Namespace to separate exponential easing equations.
  345. *
  346. * @namespace
  347. */
  348. Expo:
  349. {
  350. /**
  351. * Calculates an exponential ease-in.
  352. *
  353. * @param {number} t current time of the easing process.
  354. * @param {number} b beginning value of the esasing process.
  355. * @param {number} c change in vlaue during the easing process.
  356. * @param {number} d total duration of the easing process.
  357. *
  358. * @returns {number} current value in the easing process.
  359. */
  360. easeIn: function(t, b, c, d)
  361. {
  362. return (t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
  363. },
  364. /**
  365. * Calculates an exponential ease-out.
  366. *
  367. * @param {number} t current time of the easing process.
  368. * @param {number} b beginning value of the esasing process.
  369. * @param {number} c change in vlaue during the easing process.
  370. * @param {number} d total duration of the easing process.
  371. *
  372. * @returns {number} current value in the easing process.
  373. */
  374. easeOut: function(t, b, c, d)
  375. {
  376. return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
  377. },
  378. /**
  379. * Calculates an exponential ease-in and out.
  380. *
  381. * @param {number} t current time of the easing process.
  382. * @param {number} b beginning value of the esasing process.
  383. * @param {number} c change in vlaue during the easing process.
  384. * @param {number} d total duration of the easing process.
  385. *
  386. * @returns {number} current value in the easing process.
  387. */
  388. easeInOut: function(t, b, c, d)
  389. {
  390. if (t == 0) return b;
  391. if (t == d) return b + c;
  392. if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
  393. return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
  394. }
  395. },
  396. /**
  397. * Namespace to separate circular easing equations.
  398. *
  399. * @namespace
  400. */
  401. Circ:
  402. {
  403. /**
  404. * Calculates a circular ease-in.
  405. *
  406. * @param {number} t current time of the easing process.
  407. * @param {number} b beginning value of the esasing process.
  408. * @param {number} c change in vlaue during the easing process.
  409. * @param {number} d total duration of the easing process.
  410. *
  411. * @returns {number} current value in the easing process.
  412. */
  413. easeIn: function(t, b, c, d)
  414. {
  415. return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
  416. },
  417. /**
  418. * Calculates a circular ease-out.
  419. *
  420. * @param {number} t current time of the easing process.
  421. * @param {number} b beginning value of the esasing process.
  422. * @param {number} c change in vlaue during the easing process.
  423. * @param {number} d total duration of the easing process.
  424. *
  425. * @returns {number} current value in the easing process.
  426. */
  427. easeOut: function(t, b, c, d)
  428. {
  429. return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
  430. },
  431. /**
  432. * Calculates a circular ease-in and out.
  433. *
  434. * @param {number} t current time of the easing process.
  435. * @param {number} b beginning value of the esasing process.
  436. * @param {number} c change in vlaue during the easing process.
  437. * @param {number} d total duration of the easing process.
  438. *
  439. * @returns {number} current value in the easing process.
  440. */
  441. easeInOut: function(t, b, c, d)
  442. {
  443. if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
  444. return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
  445. }
  446. },
  447. /**
  448. * Namespace to separate elastic easing equations.
  449. *
  450. * @namespace
  451. */
  452. Elastic:
  453. {
  454. /**
  455. * Calculates an elastic ease-in.
  456. *
  457. * @param {number} t current time of the easing process.
  458. * @param {number} b beginning value of the esasing process.
  459. * @param {number} c change in vlaue during the easing process.
  460. * @param {number} d total duration of the easing process.
  461. *
  462. * @returns {number} current value in the easing process.
  463. */
  464. easeIn: function(t, b, c, d)
  465. {
  466. var s = 1.70158;
  467. var p = 0;
  468. var a = c;
  469. if (t == 0) return b;
  470. if ((t /= d) == 1) return b + c;
  471. if (!p) p = d * .3;
  472. if (a < Math.abs(c))
  473. {
  474. a = c;
  475. var s = p / 4;
  476. }
  477. else var s = p / (2 * Math.PI) * Math.asin(c / a);
  478. return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
  479. },
  480. /**
  481. * Calculates an elastic ease-out.
  482. *
  483. * @param {number} t current time of the easing process.
  484. * @param {number} b beginning value of the esasing process.
  485. * @param {number} c change in vlaue during the easing process.
  486. * @param {number} d total duration of the easing process.
  487. *
  488. * @returns {number} current value in the easing process.
  489. */
  490. easeOut: function(t, b, c, d)
  491. {
  492. var s = 1.70158;
  493. var p = 0;
  494. var a = c;
  495. if (t == 0) return b;
  496. if ((t /= d) == 1) return b + c;
  497. if (!p) p = d * .3;
  498. if (a < Math.abs(c))
  499. {
  500. a = c;
  501. var s = p / 4;
  502. }
  503. else var s = p / (2 * Math.PI) * Math.asin(c / a);
  504. return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
  505. },
  506. /**
  507. * Calculates an elastic ease-in and out.
  508. *
  509. * @param {number} t current time of the easing process.
  510. * @param {number} b beginning value of the esasing process.
  511. * @param {number} c change in vlaue during the easing process.
  512. * @param {number} d total duration of the easing process.
  513. *
  514. * @returns {number} current value in the easing process.
  515. */
  516. easeInOut: function(t, b, c, d)
  517. {
  518. var s = 1.70158;
  519. var p = 0;
  520. var a = c;
  521. if (t == 0) return b;
  522. if ((t /= d / 2) == 2) return b + c;
  523. if (!p) p = d * (.3 * 1.5);
  524. if (a < Math.abs(c))
  525. {
  526. a = c;
  527. var s = p / 4;
  528. }
  529. else var s = p / (2 * Math.PI) * Math.asin(c / a);
  530. if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
  531. return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;
  532. },
  533. },
  534. /**
  535. * Namespace to separate back easing equations.
  536. *
  537. * @namespace
  538. */
  539. Back:
  540. {
  541. /**
  542. * Calculates a back ease-in.
  543. *
  544. * @param {number} t current time of the easing process.
  545. * @param {number} b beginning value of the esasing process.
  546. * @param {number} c change in vlaue during the easing process.
  547. * @param {number} d total duration of the easing process.
  548. *
  549. * @returns {number} current value in the easing process.
  550. */
  551. easeIn: function(t, b, c, d)
  552. {
  553. var s = 1.70158;
  554. return c * (t /= d) * t * ((s + 1) * t - s) + b;
  555. },
  556. /**
  557. * Calculates a back ease-out.
  558. *
  559. * @param {number} t current time of the easing process.
  560. * @param {number} b beginning value of the esasing process.
  561. * @param {number} c change in vlaue during the easing process.
  562. * @param {number} d total duration of the easing process.
  563. *
  564. * @returns {number} current value in the easing process.
  565. */
  566. easeOut: function(t, b, c, d)
  567. {
  568. var s = 1.70158;
  569. return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
  570. },
  571. /**
  572. * Calculates a back ease-in and out.
  573. *
  574. * @param {number} t current time of the easing process.
  575. * @param {number} b beginning value of the esasing process.
  576. * @param {number} c change in vlaue during the easing process.
  577. * @param {number} d total duration of the easing process.
  578. *
  579. * @returns {number} current value in the easing process.
  580. */
  581. easeInOut: function(t, b, c, d)
  582. {
  583. var s = 1.70158;
  584. if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;
  585. return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
  586. }
  587. },
  588. /**
  589. * Namespace to separate bounce easing equations.
  590. *
  591. * @namespace
  592. */
  593. Bounce:
  594. {
  595. /**
  596. * Calculates a bounce ease-in.
  597. *
  598. * @param {number} t current time of the easing process.
  599. * @param {number} b beginning value of the esasing process.
  600. * @param {number} c change in vlaue during the easing process.
  601. * @param {number} d total duration of the easing process.
  602. *
  603. * @returns {number} current value in the easing process.
  604. */
  605. easeIn: function(t, b, c, d)
  606. {
  607. return c - Easings.Bounce.easeOut(d - t, 0, c, d) + b;
  608. },
  609. /**
  610. * Calculates a bounce ease-out.
  611. *
  612. * @param {number} t current time of the easing process.
  613. * @param {number} b beginning value of the esasing process.
  614. * @param {number} c change in vlaue during the easing process.
  615. * @param {number} d total duration of the easing process.
  616. *
  617. * @returns {number} current value in the easing process.
  618. */
  619. easeOut: function(t, b, c, d)
  620. {
  621. if ((t /= d) < (1 / 2.75))
  622. return c * (7.5625 * t * t) + b;
  623. else if (t < (2 / 2.75))
  624. return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;
  625. else if (t < (2.5 / 2.75))
  626. return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;
  627. else
  628. return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
  629. },
  630. /**
  631. * Calculates a bounce ease-in and out.
  632. *
  633. * @param {number} t current time of the easing process.
  634. * @param {number} b beginning value of the esasing process.
  635. * @param {number} c change in vlaue during the easing process.
  636. * @param {number} d total duration of the easing process.
  637. *
  638. * @returns {number} current value in the easing process.
  639. */
  640. easeInOut: function(t, b, c, d)
  641. {
  642. if (t < d / 2) return Easings.Bounce.easeIn(t * 2, 0, c, d) * .5 + b;
  643. return Easings.Bounce.easeOut(t * 2 - d, 0, c, d) * .5 + c * .5 + b;
  644. }
  645. },
  646. }