You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

150 lines
4.7KB

  1. /**
  2. * jQuery Roundabout Shapes v1.1
  3. * http://fredhq.com/projects/roundabout-shapes/
  4. *
  5. * Provides additional paths along which items can move for the
  6. * jQuery Roundabout plugin (v1.0+).
  7. *
  8. * Terms of Use // jQuery Roundabout Shapes
  9. *
  10. * Open source under the BSD license
  11. *
  12. * Copyright (c) 2009, Fred LeBlanc
  13. * All rights reserved.
  14. *
  15. * Redistribution and use in source and binary forms, with or without
  16. * modification, are permitted provided that the following conditions are met:
  17. *
  18. * - Redistributions of source code must retain the above copyright
  19. * notice, this list of conditions and the following disclaimer.
  20. * - Redistributions in binary form must reproduce the above
  21. * copyright notice, this list of conditions and the following
  22. * disclaimer in the documentation and/or other materials provided
  23. * with the distribution.
  24. * - Neither the name of the author nor the names of its contributors
  25. * may be used to endorse or promote products derived from this
  26. * software without specific prior written permission.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  29. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  30. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  31. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  32. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  33. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  34. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  35. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  36. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  37. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  38. * POSSIBILITY OF SUCH DAMAGE.
  39. */
  40. jQuery.extend(jQuery.roundabout_shape,
  41. {
  42. theJuggler: function(r, a, t) {
  43. return {
  44. x: Math.sin(r + a),
  45. y: Math.tan(Math.exp(Math.log(r)) + a) / (t - 1),
  46. z: (Math.cos(r + a) + 1) / 2,
  47. scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5
  48. };
  49. },
  50. figure8: function(r, a, t) {
  51. return {
  52. x: Math.sin(r * 2 + a),
  53. y: (Math.sin(r + Math.PI/2 + a) / 8) * t,
  54. z: (Math.cos(r + a) + 1) / 2,
  55. scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5
  56. };
  57. },
  58. waterWheel: function(r, a, t) {
  59. return {
  60. x: (Math.sin(r + Math.PI/2 + a) / 8) * t,
  61. y: Math.sin(r + a) / (Math.PI/2),
  62. z: (Math.cos(r + a) + 1) / 2,
  63. scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5
  64. };
  65. },
  66. square: function(r, a, t) {
  67. var sq_x, sq_y, sq_z;
  68. if (r <= Math.PI/2) {
  69. sq_x = (2/Math.PI) * r;
  70. sq_y = -(2/Math.PI) * r + 1;
  71. sq_z = -(1/Math.PI) * r + 1;
  72. } else if (r > Math.PI/2 && r <= Math.PI) {
  73. sq_x = -(2/Math.PI) * r + 2;
  74. sq_y = -(2/Math.PI) * r + 1;
  75. sq_z = -(1/Math.PI) * r + 1;
  76. } else if (r > Math.PI && r <= (3 * Math.PI) / 2) {
  77. sq_x = -(2/Math.PI) * r + 2;
  78. sq_y = (2/Math.PI) * r - 3;
  79. sq_z = (1/Math.PI) * r - 1;
  80. } else {
  81. sq_x = (2/Math.PI) * r - 4;
  82. sq_y = (2/Math.PI) * r - 3;
  83. sq_z = (1/Math.PI) * r - 1;
  84. }
  85. return {
  86. x: sq_x,
  87. y: sq_y * t,
  88. z: sq_z,
  89. scale: sq_z
  90. }
  91. },
  92. conveyorBeltLeft: function(r, a, t) {
  93. return {
  94. x: -Math.cos(r + a),
  95. y: (Math.cos(r + 3*Math.PI/2 + a) / 8) * t,
  96. z: (Math.sin(r + a) + 1) / 2,
  97. scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5
  98. };
  99. },
  100. conveyorBeltRight: function(r, a, t) {
  101. return {
  102. x: Math.cos(r + a),
  103. y: (Math.cos(r + 3*Math.PI/2 + a) / 8) * t,
  104. z: (Math.sin(r + a) + 1) / 2,
  105. scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5
  106. };
  107. },
  108. goodbyeCruelWorld: function(r, a, t) {
  109. return {
  110. x: Math.sin(r + a),
  111. y: (Math.tan(r + 3*Math.PI/2 + a) / 8) * (t + 0.5),
  112. z: (Math.sin(r + a) + 1) / 2,
  113. scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5
  114. };
  115. },
  116. diagonalRingLeft: function(r, a, t) {
  117. return {
  118. x: Math.sin(r + a),
  119. y: -Math.cos(r + Math.tan(Math.cos(a))) / (t + 1.5),
  120. z: (Math.cos(r + a) + 1) / 2,
  121. scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5
  122. };
  123. },
  124. diagonalRingRight: function(r, a, t) {
  125. return {
  126. x: Math.sin(r + a),
  127. y: Math.cos(r + Math.tan(Math.cos(a))) / (t + 1.5),
  128. z: (Math.cos(r + a) + 1) / 2,
  129. scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5
  130. };
  131. },
  132. rollerCoaster: function(r, a, t) {
  133. return {
  134. x: Math.sin(r + a),
  135. y: Math.sin((2 + t) * r),
  136. z: (Math.cos(r + a) + 1) / 2,
  137. scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5
  138. }
  139. },
  140. tearDrop: function(r, a, t) {
  141. return {
  142. x: Math.sin(r + a),
  143. y: -Math.sin(r/2 + t) + 0.35,
  144. z: (Math.cos(r + a) + 1) / 2,
  145. scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5
  146. }
  147. }
  148. });