Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. function runSlide(polyParent, stepDuration, transitionDuration) {
  2. function slider(polyParent, stepDuration, transitionDuration) {
  3. this.iterate = function() {
  4. $t = this;
  5. if ($t.polygons.length > 0) {
  6. $t.polygons
  7. .delay($t.polyIndex * $t.step)
  8. .qcss({
  9. display: "inline",
  10. transform: "translateY(-" + ($t.polyParent.height() * 5 * $t.stepsLeft / $t.slideFrom) + "px)",
  11. "transition-duration": $t.transitionDuration,
  12. "-webkit-transition-duration": $t.transitionDuration,
  13. "-moz-transition-duration": $t.transitionDuration,
  14. "-o-transition-duration": $t.transitionDuration
  15. });
  16. $t.lastStep = $t.stepsLeft;
  17. }
  18. $t.stepsLeft--;
  19. };
  20. this.slide = function() {
  21. $t = this;
  22. //$t.polyParent.find("polygon").hide();
  23. while ($t.nextPoly().length > 0) {
  24. while ($t.stepsLeft >= 0) {
  25. $t.iterate();
  26. }
  27. }
  28. };
  29. this.nextPoly = function() {
  30. this.polyIndex++;
  31. this.stepsLeft = this.slideFrom;
  32. this.lastStep = 0;
  33. polys = this.polyParent.find("[data-volume-index="+this.polyIndex+"]");
  34. if (polys.length > 0 && polys.first().prop("tagName").toLowerCase() != "polygon") {
  35. return this.nextPoly();
  36. }
  37. this.polygons = polys;
  38. return this.polygons
  39. };
  40. this.polyIndex = 0;
  41. this.slideFrom = 2; // number of length units to slide, one per step.
  42. this.step = stepDuration || 50; //ms duration
  43. this.transitionDuration = transitionDuration || "0.5s";
  44. this.polyParent = polyParent || $("svg");
  45. };
  46.  
  47. var s = new slider(polyParent, stepDuration, transitionDuration);
  48. s.slide();
  49. return s;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement