| 1 | // Animation Timeline |
| 2 | const animationTimeline = () => { |
| 3 | // Spit chars that needs to be animated individually |
| 4 | const textBoxChars = document.getElementsByClassName("hbd-chatbox")[0]; |
| 5 | const hbd = document.getElementsByClassName("wish-hbd")[0]; |
| 6 | |
| 7 | textBoxChars.innerHTML = `<span>${textBoxChars.innerHTML |
| 8 | .split("") |
| 9 | .join("</span><span>")}</span`; |
| 10 | |
| 11 | hbd.innerHTML = `<span>${hbd.innerHTML |
| 12 | .split("") |
| 13 | .join("</span><span>")}</span`; |
| 14 | |
| 15 | const ideaTextTrans = { |
| 16 | opacity: 0, |
| 17 | y: -20, |
| 18 | rotationX: 5, |
| 19 | skewX: "15deg" |
| 20 | }; |
| 21 | |
| 22 | const ideaTextTransLeave = { |
| 23 | opacity: 0, |
| 24 | y: 20, |
| 25 | rotationY: 5, |
| 26 | skewX: "-15deg" |
| 27 | }; |
| 28 | |
| 29 | const tl = new TimelineMax(); |
| 30 | |
| 31 | tl |
| 32 | .to(".container", 0.1, { |
| 33 | visibility: "visible" |
| 34 | }) |
| 35 | .from(".one", 0.7, { |
| 36 | opacity: 0, |
| 37 | y: 10 |
| 38 | }) |
| 39 | .from(".two", 0.4, { |
| 40 | opacity: 0, |
| 41 | y: 10 |
| 42 | }) |
| 43 | .to( |
| 44 | ".one", |
| 45 | 0.7, |
| 46 | { |
| 47 | opacity: 0, |
| 48 | y: 10 |
| 49 | }, |
| 50 | "+=2.5" |
| 51 | ) |
| 52 | .to( |
| 53 | ".two", |
| 54 | 0.7, |
| 55 | { |
| 56 | opacity: 0, |
| 57 | y: 10 |
| 58 | }, |
| 59 | "-=1" |
| 60 | ) |