File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,11 +19,48 @@ body {
1919 font-family : "Roboto" , sans-serif;
2020}
2121
22+ @media (hover : hover) and (pointer : fine) {
23+ body ,
24+ a ,
25+ button ,
26+ input ,
27+ textarea {
28+ cursor : none;
29+ }
30+ }
31+
2232img {
2333 max-width : 100% ;
2434 height : auto;
2535}
2636
37+ .cursor-dot ,
38+ .cursor-ring {
39+ position : fixed;
40+ top : 0 ;
41+ left : 0 ;
42+ pointer-events : none;
43+ opacity : 0 ;
44+ z-index : 10002 ;
45+ transform : translate (-50% , -50% );
46+ }
47+
48+ .cursor-dot {
49+ width : 8px ;
50+ height : 8px ;
51+ border-radius : 50% ;
52+ background-color : # ffffff ;
53+ }
54+
55+ .cursor-ring {
56+ width : 34px ;
57+ height : 34px ;
58+ border-radius : 50% ;
59+ border : 1px solid rgba (255 , 255 , 255 , 0.5 );
60+ background-color : rgba (255 , 255 , 255 , 0.06 );
61+ backdrop-filter : blur (3px );
62+ }
63+
2764.section-title {
2865 color : var (--secondary-color );
2966 text-align : center;
@@ -502,6 +539,12 @@ footer span a {
502539 transform : translate (-50% , -50% );
503540}
504541
542+ .cursor-hover .cursor-ring {
543+ background-color : rgba (255 , 255 , 255 , 0.1 );
544+ border-color : rgba (255 , 255 , 255 , 0.9 );
545+ backdrop-filter : blur (0 );
546+ }
547+
505548@media (max-width : 1024px ) {
506549 .about-text ,
507550 .education-container ,
@@ -628,4 +671,4 @@ footer span a {
628671 # submitBtn {
629672 width : 100% ;
630673 }
631- }
674+ }
Original file line number Diff line number Diff line change 1616
1717< body >
1818 < div id ="tsparticles "> </ div >
19+ < div class ="cursor-dot " aria-hidden ="true "> </ div >
20+ < div class ="cursor-ring " aria-hidden ="true "> </ div >
1921 < header >
2022 < button class ="menu-toggle " type ="button " aria-label ="Ouvrir le menu " aria-expanded ="false " aria-controls ="site-nav ">
2123 < span > </ span >
Original file line number Diff line number Diff line change @@ -57,4 +57,84 @@ gsap.from(".contact-container", {
5757 start : "center 70%"
5858 } ,
5959 ease : "power2.out"
60- } ) ;
60+ } ) ;
61+
62+ if ( window . matchMedia ( "(hover: hover) and (pointer: fine)" ) . matches ) {
63+ const cursorDot = document . querySelector ( ".cursor-dot" ) ;
64+ const cursorRing = document . querySelector ( ".cursor-ring" ) ;
65+ const interactiveElements = document . querySelectorAll ( "a, button, .project-media, .projects-card" ) ;
66+
67+ gsap . set ( [ cursorDot , cursorRing ] , { xPercent : - 50 , yPercent : - 50 } ) ;
68+
69+ window . addEventListener ( "mousemove" , ( e ) => {
70+ gsap . to ( cursorDot , {
71+ x : e . clientX ,
72+ y : e . clientY ,
73+ duration : 0.12 ,
74+ opacity : 1 ,
75+ ease : "power2.out" ,
76+ overwrite : "auto"
77+ } ) ;
78+
79+ gsap . to ( cursorRing , {
80+ x : e . clientX ,
81+ y : e . clientY ,
82+ duration : 0.8 ,
83+ opacity : 1 ,
84+ ease : "power3.out" ,
85+ overwrite : "auto"
86+ } ) ;
87+ } ) ;
88+
89+ document . addEventListener ( "mouseleave" , ( ) => {
90+ gsap . to ( [ cursorDot , cursorRing ] , {
91+ opacity : 0 ,
92+ duration : 0.2 ,
93+ overwrite : "auto"
94+ } ) ;
95+ } ) ;
96+
97+ document . addEventListener ( "mouseenter" , ( ) => {
98+ gsap . to ( [ cursorDot , cursorRing ] , {
99+ opacity : 1 ,
100+ duration : 0.2 ,
101+ overwrite : "auto"
102+ } ) ;
103+ } ) ;
104+
105+ interactiveElements . forEach ( ( element ) => {
106+ element . addEventListener ( "mouseenter" , ( ) => {
107+ document . body . classList . add ( "cursor-hover" ) ;
108+
109+ gsap . to ( cursorDot , {
110+ scale : 0.6 ,
111+ duration : 0.2 ,
112+ overwrite : "auto"
113+ } ) ;
114+
115+ gsap . to ( cursorRing , {
116+ scale : 1.7 ,
117+ duration : 0.25 ,
118+ ease : "power2.out" ,
119+ overwrite : "auto"
120+ } ) ;
121+ } ) ;
122+
123+ element . addEventListener ( "mouseleave" , ( ) => {
124+ document . body . classList . remove ( "cursor-hover" ) ;
125+
126+ gsap . to ( cursorDot , {
127+ scale : 1 ,
128+ duration : 0.2 ,
129+ overwrite : "auto"
130+ } ) ;
131+
132+ gsap . to ( cursorRing , {
133+ scale : 1 ,
134+ duration : 0.25 ,
135+ ease : "power2.out" ,
136+ overwrite : "auto"
137+ } ) ;
138+ } ) ;
139+ } ) ;
140+ }
You can’t perform that action at this time.
0 commit comments