Wedding Invitation
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.

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. (function () {
  2. var falling = true;
  3. TweenLite.set("#container", { perspective: 600 })
  4. //TweenLite.set("img",{xPercent:"-50%",yPercent:"-50%"})
  5. var total = 10;
  6. var container = document.getElementById("container"), w = window.innerWidth, h = window.innerHeight;
  7. for (let i = 0; i < total; i++) {
  8. var Div = document.createElement('div');
  9. var Div2 = document.createElement('div');
  10. var Div3 = document.createElement('div');
  11. TweenLite.set(Div, { attr: { class: 'dot' }, x: R(0, w), y: R(-200, -150), z: R(-200, 200), xPercent: "-50%", yPercent: "-50%" });
  12. TweenLite.set(Div2, { attr: { class: 'dot2' }, x: R(0, w), y: R(-200, -150), z: R(-200, 200), xPercent: "-50%", yPercent: "-50%" });
  13. TweenLite.set(Div3, { attr: { class: 'dot3' }, x: R(0, w), y: R(-200, -150), z: R(-200, 200), xPercent: "-50%", yPercent: "-50%" });
  14. container.appendChild(Div);
  15. container.appendChild(Div2);
  16. container.appendChild(Div3);
  17. animm(Div);
  18. animm2(Div2);
  19. animm3(Div3);
  20. }
  21. function animm(elm) {
  22. TweenMax.to(elm, R(6, 15), { y: h + 100, ease: Linear.easeNone, repeat: -1, delay: -15 });
  23. TweenMax.to(elm, R(4, 8), { x: '+=100', rotationZ: R(0, 180), repeat: -1, yoyo: true, ease: Sine.easeInOut });
  24. TweenMax.to(elm, R(2, 8), { repeat: -1, yoyo: true, ease: Sine.easeInOut, delay: -5 });
  25. };
  26. function animm2(elm) {
  27. TweenMax.to(elm, R(6, 15), { y: h + 100, ease: Linear.easeNone, repeat: -1, delay: -25 });
  28. TweenMax.to(elm, R(4, 8), { x: '+=100', rotationZ: R(0, 180), repeat: -1, yoyo: true, ease: Sine.easeInOut });
  29. TweenMax.to(elm, R(2, 8), { repeat: -1, yoyo: true, ease: Sine.easeInOut, delay: -5 });
  30. };
  31. function animm3(elm) {
  32. TweenMax.to(elm, R(6, 15), { y: h + 100, ease: Linear.easeNone, repeat: -1, delay: -5 });
  33. TweenMax.to(elm, R(4, 8), { x: '+=100', rotationZ: R(0, 180), repeat: -1, yoyo: true, ease: Sine.easeInOut });
  34. TweenMax.to(elm, R(2, 8), { repeat: -1, yoyo: true, ease: Sine.easeInOut, delay: -5 });
  35. };
  36. function R(min, max) { return min + Math.random() * (max - min) };
  37. })();