@@ -34,11 +34,6 @@ const mobileZoomFade = 48
3434// Allow for rounding in rAF timestamps at 60 Hz and cap redraws on faster displays.
3535const frameInterval = 1000 / 60 - 1
3636const markerElevation = 0.015
37- const entranceThreshold = 0.25
38- const entranceDuration = 850
39- const entranceRise = 56
40- const entranceScale = 0.72
41- const mobileEntranceScale = 0.93
4237const profileClearance = 12
4338const viewportGutter = 16
4439const offscreenBadgeMinRemaining = 96
@@ -850,7 +845,6 @@ export function MaintainersMap({ maintainers }: MaintainersMapProps) {
850845 const container = host
851846 const instance = globe
852847 const canvasSurface = surface
853- const scene = container . querySelector < HTMLElement > ( '[data-globe-overlay]' )
854848 const section = container . closest ( 'section' )
855849 const help = section ?. querySelector ( '#maintainers-globe-help' )
856850 const intro = section ?. parentElement ?. querySelector ( ':scope > header' )
@@ -921,26 +915,17 @@ export function MaintainersMap({ maintainers }: MaintainersMapProps) {
921915 passive : true ,
922916 } )
923917 visualViewport ?. addEventListener ( 'resize' , updateViewport )
924- let visible = false
918+ let nearViewport = false
925919 let anchors = new Map < string , Anchor > ( )
926920 let wasGlobeVisible = false
927921 let layoutMoving = true
928922 let wasIdle = true
929- let entranceVisible = false
930- let entered = container . hasAttribute ( 'data-globe-entered' )
931- let entrancePrepared = false
932- let entranceStart : number | undefined
933- if ( scene ) scene . style . transform = ''
934- if ( entered ) scene ?. removeAttribute ( 'inert' )
935923 const observer = new IntersectionObserver (
936924 ( [ entry ] ) => {
937- visible = entry . isIntersecting
938- entranceVisible =
939- visible && entry . intersectionRatio >= entranceThreshold
940- if ( ! entranceVisible ) entrancePrepared = false
925+ nearViewport = entry . isIntersecting
941926 updateViewport ( )
942927 } ,
943- { threshold : [ 0 , entranceThreshold ] } ,
928+ { rootMargin : '25%' } ,
944929 )
945930 observer . observe ( host )
946931 const mobile = window . matchMedia ( mobileViewport )
@@ -958,14 +943,8 @@ export function MaintainersMap({ maintainers }: MaintainersMapProps) {
958943 if ( elapsed >= frameInterval ) {
959944 lastFrame = now
960945 const bounds = hostSize . current
961- const {
962- height,
963- centerY,
964- paintWidth,
965- paintHeight,
966- paintTop,
967- projectionHeight,
968- } = bounds
946+ const { centerY, paintWidth, paintHeight, paintTop, projectionHeight } =
947+ bounds
969948 const radius = projectionHeight * view . current . scale * globeRadius
970949 const globeTop = centerY - radius
971950 const globeBottom = centerY + radius
@@ -984,17 +963,16 @@ export function MaintainersMap({ maintainers }: MaintainersMapProps) {
984963 const visibilityChanged = globeVisible !== wasGlobeVisible
985964 wasGlobeVisible = globeVisible
986965 if (
987- ( visible || globeVisible || visibilityChanged ) &&
966+ ( nearViewport || globeVisible || visibilityChanged ) &&
988967 ! document . hidden
989968 ) {
990- const preparing = entranceVisible && ! entered
991969 const readingProfile = container . querySelector (
992970 '[data-globe-profile]:hover, [data-globe-profile]:focus-within' ,
993971 )
994972 const idle = ! readingProfile && ! interacting . current
995973 const autoRotate =
996974 globeVisible && ! reducedMotion && ! pausedRef . current
997- if ( entered && autoRotate && idle ) {
975+ if ( autoRotate && idle ) {
998976 target . current . phi += Math . min ( elapsed , 100 ) * 0.00015
999977 }
1000978 const current = view . current ,
@@ -1017,51 +995,28 @@ export function MaintainersMap({ maintainers }: MaintainersMapProps) {
1017995 viewportChanged ||
1018996 visibilityChanged ||
1019997 layoutMoving ||
1020- ( preparing && ! profileNodes . current ) ||
1021998 ( idle && ! wasIdle )
1022999 ) {
10231000 const nodes = profileNodes . current ?? readProfileNodes ( container )
10241001 // The ClientOnly portraits may mount a frame after the pins.
10251002 if ( nodes . length === groupsRef . current . length )
10261003 profileNodes . current = nodes
1027- layoutMoving = placeProfiles (
1028- nodes ,
1029- hostSize . current ,
1030- mobile . matches ,
1031- anchors ,
1032- profilePositions ,
1033- elapsed ,
1034- idle ,
1035- viewport ,
1036- globeVisible ,
1037- )
1004+ layoutMoving =
1005+ placeProfiles (
1006+ nodes ,
1007+ hostSize . current ,
1008+ mobile . matches ,
1009+ anchors ,
1010+ profilePositions ,
1011+ elapsed ,
1012+ idle ,
1013+ viewport ,
1014+ globeVisible ,
1015+ ) || ! profileNodes . current
10381016 viewportChanged = false
10391017 }
10401018 wasIdle = idle
1041- // Let the browser paint the hidden surface before revealing the scene.
1042- const reveal =
1043- preparing &&
1044- profileNodes . current !== undefined &&
1045- ( entrancePrepared || reducedMotion )
1046- if ( preparing && profileNodes . current ) entrancePrepared = true
1047- const entering = entranceStart !== undefined
1048- const progress =
1049- entranceStart === undefined
1050- ? Number ( entered || reducedMotion )
1051- : Math . min ( 1 , ( now - entranceStart ) / entranceDuration )
1052- const remaining = ( 1 - progress ) ** 4
1053- const startScale = mobile . matches
1054- ? mobileEntranceScale
1055- : entranceScale
1056- const entryScale = 1 - ( 1 - startScale ) * remaining
1057- const offsetY = entranceRise * remaining
1058- if ( ( entering || reveal ) && scene ) {
1059- // Apply the camera's entrance motion to the interactive overlays.
1060- scene . style . transform = remaining
1061- ? `translateY(${ offsetY } px) scale(${ entryScale } )`
1062- : ''
1063- }
1064- if ( ( redraw || entering ) && paintHeight > 0 ) {
1019+ if ( redraw && paintHeight > 0 ) {
10651020 if (
10661021 mobile . matches &&
10671022 ( current . scale !== fadedScale || bounds !== fadedBounds )
@@ -1087,33 +1042,12 @@ export function MaintainersMap({ maintainers }: MaintainersMapProps) {
10871042 }
10881043 const paintView = {
10891044 ...current ,
1090- scale :
1091- ( current . scale * projectionHeight * entryScale ) / paintHeight ,
1045+ scale : ( current . scale * projectionHeight ) / paintHeight ,
10921046 }
1093- instance . draw (
1094- paintView ,
1095- paintWidth ,
1096- paintHeight ,
1097- offsetY +
1098- ( centerY - height / 2 ) * entryScale +
1099- ( height - paintHeight ) / 2 -
1100- paintTop ,
1101- )
1102- }
1103- if ( progress === 1 ) entranceStart = undefined
1104- if ( reveal ) {
1105- entered = true
1106- if ( ! reducedMotion ) entranceStart = now
1107- container . setAttribute ( 'data-globe-entered' , '' )
1108- scene ?. removeAttribute ( 'inert' )
1047+ instance . draw ( paintView , paintWidth , paintHeight )
11091048 }
11101049 dirty . current = false
1111- keepAnimating =
1112- autoRotate ||
1113- entranceStart !== undefined ||
1114- ( preparing && ! entered ) ||
1115- moving ||
1116- layoutMoving
1050+ keepAnimating = autoRotate || moving || layoutMoving
11171051 }
11181052 }
11191053 if ( keepAnimating ) requestFrame ( )
@@ -1242,18 +1176,6 @@ export function MaintainersMap({ maintainers }: MaintainersMapProps) {
12421176 0% { transform: scale(0.45); opacity: 0.7; }
12431177 80%, 100% { transform: scale(2); opacity: 0; }
12441178 }
1245- @media (prefers-reduced-motion: no-preference) {
1246- [data-globe-scene] { opacity: 0; }
1247- [data-globe-entered] [data-globe-scene] {
1248- opacity: 1;
1249- animation: maintainer-globe-enter ${ entranceDuration } ms cubic-bezier(0.16, 1, 0.3, 1);
1250- }
1251- }
1252- @keyframes maintainer-globe-enter {
1253- from { opacity: 0; }
1254- 25% { opacity: 1; }
1255- to { opacity: 1; }
1256- }
12571179 ` } </ style >
12581180 < div className = "relative h-(--globe-height)" >
12591181 < div
@@ -1289,21 +1211,11 @@ export function MaintainersMap({ maintainers }: MaintainersMapProps) {
12891211 className = "absolute inset-y-0 left-1/2 w-(--globe-width) -translate-x-1/2 outline-offset-4"
12901212 >
12911213 < div
1292- data-globe-scene
1293- className = "pointer-events-none absolute inset-0 -z-10"
1294- >
1295- < div
1296- ref = { setSurface }
1297- data-globe-surface
1298- className = "absolute inset-x-0 top-0 h-full sm:top-1/2 sm:h-(--globe-width) sm:-translate-y-1/2"
1299- />
1300- </ div >
1301- < div
1302- data-globe-scene
1303- data-globe-overlay
1304- inert
1305- className = "absolute inset-0"
1306- >
1214+ ref = { setSurface }
1215+ data-globe-surface
1216+ className = "pointer-events-none absolute inset-x-0 top-0 -z-10 h-full sm:top-1/2 sm:h-(--globe-width) sm:-translate-y-1/2"
1217+ />
1218+ < div className = "absolute inset-0" >
13071219 < div className = "absolute inset-0 touch-pan-y cursor-grab active:cursor-grabbing" />
13081220 < svg
13091221 aria-hidden = "true"
0 commit comments