@@ -28,6 +28,13 @@ const ghostContainerClass = css`
2828 bottom : 16px ;
2929 }
3030
31+ @media (max-width : 600px ) {
32+ & .mobile-middle {
33+ bottom : clamp (9.5rem , 29vh , 14rem );
34+ transform : translateX (50% ) scale (0.43 );
35+ }
36+ }
37+
3138 & .is-entering {
3239 animation : ${ slideInFromRight } 1.2s cubic-bezier (0.22 , 0.9 , 0.22 , 1 ) both;
3340 }
@@ -39,12 +46,12 @@ const ghostContainerClass = css`
3946 }
4047
4148 & .is-entering-left {
42- animation : ${ slideInFromLeft } 1 .2s cubic-bezier (0.22 , 0.9 , 0.22 , 1 ) both;
49+ animation : ${ slideInFromLeft } 3 .2s cubic-bezier (0.22 , 0.9 , 0.22 , 1 ) both;
4350 }
4451
4552 @media (max-width : 600px ) {
4653 & .is-entering-left {
47- animation : ${ slideInFromLeftMobile } 1 .2s cubic-bezier (0.22 , 0.9 , 0.22 , 1 ) both;
54+ animation : ${ slideInFromLeftMobile } 3 .2s cubic-bezier (0.22 , 0.9 , 0.22 , 1 ) both;
4855 }
4956 }
5057
@@ -57,6 +64,10 @@ const ghostContainerClass = css`
5764 }
5865 }
5966
67+ & .is-moving .is-moving-slow {
68+ transition-duration : 3.4s ;
69+ }
70+
6071 & .is-sleeping {
6172 pointer-events : none;
6273 }
@@ -81,11 +92,11 @@ const ghostContainerClass = css`
8192 opacity : 1 ;
8293 }
8394
84- & .is-moving .ghost-eye {
95+ & .is-moving . use-wake-eye .ghost-eye {
8596 opacity : 0 ;
8697 }
8798
88- & .is-moving .wake-eye {
99+ & .is-moving . use-wake-eye .wake-eye {
89100 opacity : 1 ;
90101 }
91102
@@ -273,6 +284,9 @@ type Props = {
273284 showNotes ?: boolean ;
274285 enteringFromRight ?: boolean ;
275286 enteringFromLeft ?: boolean ;
287+ wakeEyesOnMove ?: boolean ;
288+ slowMove ?: boolean ;
289+ mobilePlacement ?: "bottom" | "button" ;
276290} ;
277291
278292export const SlidingGhost = ( {
@@ -281,12 +295,17 @@ export const SlidingGhost = ({
281295 showNotes = false ,
282296 enteringFromRight = false ,
283297 enteringFromLeft = false ,
298+ wakeEyesOnMove = true ,
299+ slowMove = false ,
300+ mobilePlacement = "bottom" ,
284301} : Props ) => {
285302 const bodyId = "sliding-ghost-body" ;
286303 const isInteractive = ! isMoving && ! isSleeping ;
287304 const className = `${ ghostContainerClass } ${ isMoving ? "is-moving" : "" } ${ isSleeping ? "is-sleeping" : "" } ${
288305 enteringFromRight ? "is-entering" : ""
289- } ${ enteringFromLeft ? "is-entering-left" : "" } `;
306+ } ${ enteringFromLeft ? "is-entering-left" : "" } ${ wakeEyesOnMove ? "use-wake-eye" : "" } ${
307+ slowMove ? "is-moving-slow" : ""
308+ } ${ mobilePlacement === "button" ? "mobile-middle" : "" } `;
290309
291310 return (
292311 < div class = { className } >
0 commit comments