| 9 | }; |
| 10 | |
| 11 | export class Intro { |
| 12 | constructor(el) { |
| 13 | // the SVG element |
| 14 | this.DOM = {el: el}; |
| 15 | // SVG texts |
| 16 | this.DOM.circleText = [...this.DOM.el.querySelectorAll('text.circles__text')]; |
| 17 | // total |
| 18 | this.circleTextTotal = this.DOM.circleText.length; |
| 19 | |
| 20 | this.setup(); |
| 21 | } |
| 22 | setup() { |
| 23 | // need to set the transform origin in the center |
| 24 | gsap.set(this.DOM.circleText, { transformOrigin: '50% 50%' }); |
| 25 | // hide on start |
| 26 | gsap.set([this.DOM.circleText, DOM.content.children, DOM.frame.children], {opacity: 0}); |
| 27 | // don't allow to hover |
| 28 | gsap.set(DOM.enterCtrl, {pointerEvents: 'none'}); |
| 29 | |
| 30 | this.initEvents(); |
| 31 | } |
| 32 | initEvents() { |
| 33 | this.enterMouseEnterEv = () => { |
| 34 | gsap.killTweensOf([DOM.enterBackground,this.DOM.circleText]); |
| 35 | |
| 36 | gsap.to(DOM.enterBackground, { |
| 37 | duration: 1.3, |
| 38 | ease: 'expo', |
| 39 | scale: 1.4 |
| 40 | }); |
| 41 | gsap.to(this.DOM.circleText, { |
| 42 | duration: 0.5, |
| 43 | ease: 'expo', |
| 44 | rotation: '+=120', |
| 45 | scale: 0.5, |
| 46 | opacity: 0.2, |
| 47 | stagger: { |
| 48 | amount: -0.15 |
| 49 | } |
| 50 | }); |
| 51 | }; |
| 52 | this.enterMouseLeaveEv = () => { |
| 53 | //gsap.killTweensOf([DOM.enterBackground,this.DOM.circleText]); |
| 54 | |
| 55 | gsap.to(DOM.enterBackground, { |
| 56 | duration: 2, |
| 57 | ease: 'elastic.out(1, 0.4)', |
| 58 | scale: 1 |
| 59 | }); |
| 60 | gsap.to(this.DOM.circleText, { |
| 61 | duration: 2, |
| 62 | ease: 'elastic.out(1, 0.4)', |
| 63 | scale: 1, |
| 64 | rotation: '-=120', |
| 65 | opacity: 1, |
| 66 | stagger: { |
| 67 | amount: 0.15 |
| 68 | } |
nothing calls this directly
no outgoing calls
no test coverage detected