MCPcopy Create free account
hub / github.com/codrops/CircularTextEffect / Intro

Class Intro

src/js/demo2/intro.js:11–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9};
10
11export 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
24 // need to set the transform origin in the center
25 gsap.set(this.DOM.circleText, { transformOrigin: '50% 50%' });
26 // hide on start
27 gsap.set([this.DOM.circleText, DOM.content.children, DOM.frame.children], {opacity: 0});
28 // don't allow to hover
29 gsap.set(DOM.enterCtrl, {pointerEvents: 'none'});
30
31 this.initEvents();
32 }
33 initEvents() {
34 this.enterMouseEnterEv = () => {
35 gsap.killTweensOf([DOM.enterBackground,this.DOM.circleText]);
36
37 gsap.to(DOM.enterBackground, {
38 duration: 1,
39 ease: 'expo',
40 scale: 1.4
41 });
42 gsap.to(this.DOM.circleText, {
43 duration: 1,
44 ease: 'expo',
45 scale: 1.15,
46 rotation: i => i%2 ? '-=90' : '+=90',
47 opacity: 0.4,
48
49 });
50 };
51 this.enterMouseLeaveEv = () => {
52 // gsap.killTweensOf([DOM.enterBackground,this.DOM.circleText]);
53 gsap.to(DOM.enterBackground, {
54 duration: 1,
55 ease: 'expo',
56 scale: 1
57 });
58 gsap.to(this.DOM.circleText, {
59 duration: 1,
60 ease: 'expo',
61 scale: 1,
62 rotation: i => i%2 ? '+=120' : '-=120',
63 opacity: 1,
64 stagger: {
65 amount: -0.2
66 }
67 });
68 };

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected