wodry.min.js 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /* Sergey Golovin 2014 golovim@gmail.com */
  2. (function() {
  3. var a, b = {}.hasOwnProperty;
  4. a = jQuery,
  5. a.fn.extend({
  6. wodry: function(c) {
  7. var d, e, f, g, h;
  8. return null == c && (c = {}),
  9. e = a.extend({},
  10. c),
  11. null == e.separator && (e.separator = "|"),
  12. null == e.delay && (e.delay = 2e3),
  13. null == e.animationDuration && (e.animationDuration = 1000),
  14. null == e.animation && (e.animation = "rotateY"),
  15. null == e.callback && (e.callback = function() {}),
  16. null == e.shift && (e.shift = {}),
  17. null == (f = e.shift).x && (f.x = 0),
  18. null == (g = e.shift).y && (g.y = 0),
  19. null == (h = e.shift).z && (h.z = 0),
  20. d = {
  21. rotateY: {
  22. front_transform: "translate3d(" + e.shift.x + "px," + e.shift.y + "px," + e.shift.z + "px)",
  23. back_transform: "translate3d(" + e.shift.x + "px," + e.shift.y + "px," + e.shift.z + "px) rotateY(180deg)",
  24. action: {
  25. transform: " rotateY(180deg)",
  26. transition: " " + e.animationDuration + "ms"
  27. }
  28. },
  29. rotateX: {
  30. front_transform: "translate3d(" + e.shift.x + "px," + e.shift.y + "px," + e.shift.z + "px)",
  31. back_transform: "translate3d(" + e.shift.x + "px," + e.shift.y + "px," + e.shift.z + "px) rotateX(180deg)",
  32. action: {
  33. transform: " rotateX(180deg)",
  34. transition: " " + e.animationDuration + "ms"
  35. }
  36. },
  37. rotateAll: {
  38. isCoplex: !0,
  39. front_transform: "translate3d(" + e.shift.x + "px," + e.shift.y + "px," + e.shift.z + "px) rotateX(180deg) rotateY(180deg)",
  40. back_transform: "translate3d(" + e.shift.x + "px," + e.shift.y + "px," + e.shift.z + "px) rotateX(180deg) rotateY(180deg)",
  41. action: {
  42. transform: " rotateX(180deg) rotateY(180deg)",
  43. transition: " " + e.animationDuration + "ms"
  44. }
  45. },
  46. scaleX: {
  47. isCoplex: !0,
  48. front_transform: "translate3d(" + e.shift.x + "px," + e.shift.y + "px," + e.shift.z + "px) scaleX(0.1)",
  49. back_transform: "translate3d(" + e.shift.x + "px," + e.shift.y + "px," + e.shift.z + "px) scaleX(0.1)",
  50. action: {
  51. transform: " scaleX(10)",
  52. transition: " " + e.animationDuration + "ms"
  53. }
  54. },
  55. scaleY: {
  56. isCoplex: !0,
  57. front_transform: "translate3d(" + e.shift.x + "px," + e.shift.y + "px," + e.shift.z + "px) scaleY(0.1)",
  58. back_transform: "translate3d(" + e.shift.x + "px," + e.shift.y + "px," + e.shift.z + "px) scaleY(0.1)",
  59. action: {
  60. transform: " scaleY(10)",
  61. transition: " " + e.animationDuration + "ms"
  62. }
  63. },
  64. scaleAll: {
  65. isCoplex: !0,
  66. front_transform: "translate3d(" + e.shift.x + "px," + e.shift.y + "px," + e.shift.z + "px) scaleY(0.1) slaleX(0.1)",
  67. back_transform: "translate3d(" + e.shift.x + "px," + e.shift.y + "px," + e.shift.z + "px) scaleY(0.1) scaleX(0.1)",
  68. action: {
  69. transform: " scaleY(10) scaleX(10)",
  70. transition: " " + e.animationDuration + "ms"
  71. }
  72. },
  73. anticlockwise: {
  74. isCoplex: !0,
  75. front_transform: "translate3d(" + e.shift.x + "px," + e.shift.y + "px," + e.shift.z + "px) rotate3d(100,40,-80,180deg)",
  76. back_transform: "translate3d(" + e.shift.x + "px," + e.shift.y + "px," + e.shift.z + "px) rotate3d(100,40,-80,180deg)",
  77. action: {
  78. transform: " rotate3d(100,40,-80,180deg)",
  79. transition: " " + e.animationDuration + "ms"
  80. }
  81. },
  82. clockwise: {
  83. isCoplex: !0,
  84. front_transform: "translate3d(" + e.shift.x + "px," + e.shift.y + "px," + e.shift.z + "px) rotate3d(40,100,80,180deg)",
  85. back_transform: "translate3d(" + e.shift.x + "px," + e.shift.y + "px," + e.shift.z + "px) rotate3d(40,100,80,180deg)",
  86. action: {
  87. transform: " rotate3d(40,100,80,180deg)",
  88. transition: " " + e.animationDuration + "ms"
  89. }
  90. }
  91. },
  92. this.each(function() {
  93. var c, f, g, h, i;
  94. return h = a(this),
  95. f = [],
  96. a.each(h.text().split(e.separator),
  97. function(a, b) {
  98. return f.push(b)
  99. }),
  100. h.text(f[0]),
  101. i = function(a, c) {
  102. var d, e, f, g, h, i, j, k, l, m, n;
  103. for (i = {},
  104. g = {},
  105. l = 0, m = a.length; m > l; l++) h = a[l],
  106. d = a.indexOf(h),
  107. g[h] = c[d];
  108. if (a.length === c.length) {
  109. for (h in g) b.call(g, h) && (j = g[h], n = ["-webkit-" + h, "-moz-" + h, "-o-" + h], k = n[0], e = n[1], f = n[2], i[k] = j, i[e] = j, i[f] = j, i[h] = j);
  110. return i
  111. }
  112. },
  113. c = function(b, c, d, e) {
  114. return c.html(""),
  115. a("<span class='front-face'>" + d + "</span>").appendTo(c),
  116. a("." + c.context.className + " .front-face").css(i(["transform"], [b.front_transform])),
  117. a("<span class='back-face'>" + e + "</span>").appendTo(c),
  118. a("." + c.context.className + " .back-face").css(i(["transform"], [b.back_transform])),
  119. c.wrapInner("<span class='adjecting' />").find(".adjecting").hide().show().css(i(["transform", "transition"], [b.action.transform, b.action.transition])),
  120. b.isCoplex ? setTimeout(function() {
  121. return a("." + c.context.className + " .front-face").remove()
  122. },
  123. 1) : void 0
  124. },
  125. g = function() {
  126. var b, g;
  127. return h.find(".back-face").length > 0 && h.html(h.find(".back-face").html()),
  128. g = h.text(),
  129. b = a.inArray(g, f),
  130. b + 1 === f.length && (b = -1),
  131. c(d[e.animation], h, g, f[b + 1])
  132. },
  133. setInterval(function() {
  134. return g()
  135. //e.callback()
  136. },
  137. e.delay + e.animationDuration)
  138. })
  139. }
  140. })
  141. }).call(this);
  142. //# sourceMappingURL=wodry.min.map