PageRenderTime 26ms CodeModel.GetById 33ms RepoModel.GetById 0ms app.codeStats 0ms

/qooxdoo-2.1.1-sdk/framework/source/class/qx/fx/Transition.js

https://bitbucket.org/vegansk/test_qooxdoo
JavaScript | 378 lines | 134 code | 27 blank | 217 comment | 15 complexity | a236d5ebd36163e5e907aeb9e707e58d MD5 | raw file
  1. /* ************************************************************************
  2. qooxdoo - the new era of web development
  3. http://qooxdoo.org
  4. Copyright:
  5. 2008 1&1 Internet AG, Germany, http://www.1und1.de
  6. License:
  7. LGPL: http://www.gnu.org/licenses/lgpl.html
  8. EPL: http://www.eclipse.org/org/documents/epl-v10.php
  9. See the LICENSE file in the project's top-level directory for details.
  10. Authors:
  11. * Jonathan Weiß (jonathan_rass)
  12. ======================================================================
  13. This class contains code based on the following work:
  14. * script.aculo.us
  15. http://script.aculo.us/
  16. Version 1.8.1
  17. Copyright:
  18. 2008 Thomas Fuchs
  19. License:
  20. MIT: http://www.opensource.org/licenses/mit-license.php
  21. Author:
  22. Thomas Fuchs
  23. ----------------------------------------------------------------------
  24. Copyright (c) 2005-2007 Thomas Fuchs
  25. (http://script.aculo.us, http://mir.aculo.us)
  26. Permission is hereby granted, free of charge, to any person
  27. obtaining a copy of this software and associated documentation
  28. files (the "Software"), to deal in the Software without restriction,
  29. including without limitation the rights to use, copy, modify, merge,
  30. publish, distribute, sublicense, and/or sell copies of the Software,
  31. and to permit persons to whom the Software is furnished to do so,
  32. subject to the following conditions:
  33. The above copyright notice and this permission notice shall be
  34. included in all copies or substantial portions of the Software.
  35. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  36. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  37. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  38. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  39. HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  40. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  41. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  42. DEALINGS IN THE SOFTWARE.
  43. ======================================================================
  44. This class contains code based on the following work:
  45. * Easing equations
  46. http://www.robertpenner.com/easing/
  47. Copyright:
  48. 2001 Robert Penner
  49. License:
  50. BSD: http://www.opensource.org/licenses/bsd-license.php
  51. Author:
  52. Robert Penner
  53. ----------------------------------------------------------------------
  54. http://www.robertpenner.com/easing_terms_of_use.html
  55. Copyright © 2001 Robert Penner
  56. All rights reserved.
  57. Redistribution and use in source and binary forms, with or without
  58. modification, are permitted provided that the following conditions
  59. are met:
  60. * Redistributions of source code must retain the above copyright
  61. notice, this list of conditions and the following disclaimer.
  62. * Redistributions in binary form must reproduce the above copyright
  63. notice, this list of conditions and the following disclaimer in
  64. the documentation and/or other materials provided with the
  65. distribution.
  66. * Neither the name of the author nor the names of contributors may
  67. be used to endorse or promote products derived from this software
  68. without specific prior written permission.
  69. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  70. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  71. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  72. FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  73. COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  74. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  75. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  76. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  77. HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  78. STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  79. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  80. OF THE POSSIBILITY OF SUCH DAMAGE.
  81. ************************************************************************ */
  82. /**
  83. * Static class containing all transition functions.
  84. * @deprecated {2.0} Please use qx.bom.element.Animation instead.
  85. */
  86. qx.Class.define("qx.fx.Transition",
  87. {
  88. type : "static",
  89. statics :
  90. {
  91. __warned : false,
  92. /**
  93. * Maps function name to function.
  94. *
  95. * @param functionName {String} Name off the function.
  96. * @return {Function|Boolean} Function belonging to the name or false,
  97. * function does not exist
  98. * @deprecated {2.0} Please use qx.bom.element.Animation instead.
  99. */
  100. get : function(functionName)
  101. {
  102. if (!this.__warned) {
  103. this.__warned = true;
  104. qx.log.Logger.deprecatedMethodWarning(arguments.callee,
  105. "qx.fx.* is deprecated. Please use qx.bom.element.Animation instead."
  106. );
  107. }
  108. return qx.fx.Transition[functionName] || false;
  109. },
  110. /**
  111. * Returns the given effect position without
  112. * changing it. This is the default transition
  113. * function for most effects.
  114. *
  115. * @param pos {Number} Effect position in duration
  116. * @return {Number} Modified effect position
  117. * @deprecated {2.0} Please use qx.bom.element.Animation instead.
  118. */
  119. linear : function(pos)
  120. {
  121. if (!this.__warned) {
  122. this.__warned = true;
  123. qx.log.Logger.deprecatedMethodWarning(arguments.callee,
  124. "qx.fx.* is deprecated. Please use qx.bom.element.Animation instead."
  125. );
  126. }
  127. return pos;
  128. },
  129. /**
  130. * Using this function will accelerate the effect's
  131. * impact exponentially.
  132. *
  133. * @param pos {Number} Effect position in duration
  134. * @return {Number} Modified effect position
  135. * @deprecated {2.0} Please use qx.bom.element.Animation instead.
  136. */
  137. easeInQuad : function (pos)
  138. {
  139. if (!this.__warned) {
  140. this.__warned = true;
  141. qx.log.Logger.deprecatedMethodWarning(arguments.callee,
  142. "qx.fx.* is deprecated. Please use qx.bom.element.Animation instead."
  143. );
  144. }
  145. return Math.pow(2, 10 * (pos - 1));
  146. },
  147. /**
  148. * Using this function will slow down the
  149. * effect's impact exponentially.
  150. *
  151. * @param pos {Number} Effect position in duration
  152. * @return {Number} Modified effect position
  153. * @deprecated {2.0} Please use qx.bom.element.Animation instead.
  154. */
  155. easeOutQuad : function (pos)
  156. {
  157. if (!this.__warned) {
  158. this.__warned = true;
  159. qx.log.Logger.deprecatedMethodWarning(arguments.callee,
  160. "qx.fx.* is deprecated. Please use qx.bom.element.Animation instead."
  161. );
  162. }
  163. return (-Math.pow(2, -10 * pos) + 1);
  164. },
  165. /**
  166. * Using this function will accelerate the
  167. * effect's impact sinusoidal.
  168. *
  169. * @param pos {Number} Effect position in duration
  170. * @return {Number} Modified effect position
  171. * @deprecated {2.0} Please use qx.bom.element.Animation instead.
  172. */
  173. sinodial : function(pos)
  174. {
  175. if (!this.__warned) {
  176. this.__warned = true;
  177. qx.log.Logger.deprecatedMethodWarning(arguments.callee,
  178. "qx.fx.* is deprecated. Please use qx.bom.element.Animation instead."
  179. );
  180. }
  181. return ( -Math.cos(pos * Math.PI) / 2 ) + 0.5;
  182. },
  183. /**
  184. * Using this function will reverse the
  185. * effect's impact.
  186. *
  187. * @param pos {Number} Effect position in duration
  188. * @return {Number} Modified effect position
  189. * @deprecated {2.0} Please use qx.bom.element.Animation instead.
  190. */
  191. reverse: function(pos)
  192. {
  193. if (!this.__warned) {
  194. this.__warned = true;
  195. qx.log.Logger.deprecatedMethodWarning(arguments.callee,
  196. "qx.fx.* is deprecated. Please use qx.bom.element.Animation instead."
  197. );
  198. }
  199. return 1 - pos;
  200. },
  201. /**
  202. * Using this function will alternate the
  203. * effect's impact between start end value.
  204. *
  205. * Looks only nice on color effects.
  206. *
  207. * @param pos {Number} Effect position in duration
  208. * @return {Number} Modified effect position
  209. * @deprecated {2.0} Please use qx.bom.element.Animation instead.
  210. */
  211. flicker : function(pos)
  212. {
  213. if (!this.__warned) {
  214. this.__warned = true;
  215. qx.log.Logger.deprecatedMethodWarning(arguments.callee,
  216. "qx.fx.* is deprecated. Please use qx.bom.element.Animation instead."
  217. );
  218. }
  219. var pos = ( (-Math.cos(pos * Math.PI) / 4) + 0.75) + Math.random() / 4;
  220. return pos > 1 ? 1 : pos;
  221. },
  222. /**
  223. * Using this function will bounce the
  224. * effect's impact forwards and backwards
  225. *
  226. * @param pos {Number} Effect position in duration
  227. * @return {Number} Modified effect position
  228. * @deprecated {2.0} Please use qx.bom.element.Animation instead.
  229. */
  230. wobble : function(pos)
  231. {
  232. if (!this.__warned) {
  233. this.__warned = true;
  234. qx.log.Logger.deprecatedMethodWarning(arguments.callee,
  235. "qx.fx.* is deprecated. Please use qx.bom.element.Animation instead."
  236. );
  237. }
  238. return ( -Math.cos(pos * Math.PI * (9 * pos)) / 2) + 0.5;
  239. },
  240. /**
  241. * Using this function will alternate rapidly the
  242. * effect's impact between start end value.
  243. *
  244. * Looks only nice on color effects.
  245. *
  246. * @param pos {Number} Effect position in duration
  247. * @param pulses {Number} Amount of pulses
  248. * @return {Number} Modified effect position
  249. * @deprecated {2.0} Please use qx.bom.element.Animation instead.
  250. */
  251. pulse : function(pos, pulses)
  252. {
  253. if (!this.__warned) {
  254. this.__warned = true;
  255. qx.log.Logger.deprecatedMethodWarning(arguments.callee,
  256. "qx.fx.* is deprecated. Please use qx.bom.element.Animation instead."
  257. );
  258. }
  259. pulses = (typeof(pulses) == "Number") ? pulses : 5;
  260. return (
  261. Math.round((pos % (1/pulses)) * pulses) == 0 ?
  262. Math.floor((pos * pulses * 2) - (pos * pulses * 2)) :
  263. 1 - Math.floor((pos * pulses * 2) - (pos * pulses * 2))
  264. );
  265. },
  266. /**
  267. * Using this function will overshoot the
  268. * target value and then move back the impact's
  269. * impact.
  270. *
  271. * @param pos {Number} Effect position in duration
  272. * @return {Number} Modified effect position
  273. * @deprecated {2.0} Please use qx.bom.element.Animation instead.
  274. */
  275. spring : function(pos)
  276. {
  277. if (!this.__warned) {
  278. this.__warned = true;
  279. qx.log.Logger.deprecatedMethodWarning(arguments.callee,
  280. "qx.fx.* is deprecated. Please use qx.bom.element.Animation instead."
  281. );
  282. }
  283. return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
  284. },
  285. /**
  286. * Using this function the effect's impact will be zero.
  287. *
  288. * @param pos {Number} Effect position in duration
  289. * @return {Number} Modified effect position
  290. * @deprecated {2.0} Please use qx.bom.element.Animation instead.
  291. */
  292. none : function(pos)
  293. {
  294. if (!this.__warned) {
  295. this.__warned = true;
  296. qx.log.Logger.deprecatedMethodWarning(arguments.callee,
  297. "qx.fx.* is deprecated. Please use qx.bom.element.Animation instead."
  298. );
  299. }
  300. return 0;
  301. },
  302. /**
  303. * Using this function the effect's impact will be
  304. * as if it has reached the end position.
  305. *
  306. * @param pos {Number} Effect position in duration
  307. * @return {Number} Modified effect position
  308. * @deprecated {2.0} Please use qx.bom.element.Animation instead.
  309. */
  310. full : function(pos)
  311. {
  312. if (!this.__warned) {
  313. this.__warned = true;
  314. qx.log.Logger.deprecatedMethodWarning(arguments.callee,
  315. "qx.fx.* is deprecated. Please use qx.bom.element.Animation instead."
  316. );
  317. }
  318. return 1;
  319. }
  320. }
  321. });