Key Features

🔮

3D CSS Transforms

Images positioned on a spherical surface using CSS 3D transforms with perspective. Hardware-accelerated for smooth 60fps performance.

🎮

Drag & Inertia

Drag to rotate with velocity tracking. Release to coast with realistic momentum physics and configurable dampening.

🔍

Click to Enlarge

Click any tile to enlarge with smooth FLIP-style animation. Scrim backdrop with blur effect and ESC to close.

📐

Responsive Radius

ResizeObserver automatically calculates optimal sphere radius based on container size with configurable min/max bounds.

🎨

Grayscale Filter

Optional grayscale filter on tiles for artistic effect. Easy to toggle on/off via prop.

📱

Touch Support

Full touch and pointer events support for mobile devices. Scroll locking prevents page bounce during interaction.

Basic Usage

Import the component and provide an array of images. Images can be simple string URLs or objects with src and alt properties.

<script>
  import DomeGallery from '$lib/components/DomeGallery.svelte';

  const images = [
    { src: 'https://example.com/image1.jpg', alt: 'Description 1' },
    { src: 'https://example.com/image2.jpg', alt: 'Description 2' },
    'https://example.com/image3.jpg', // Simple string URL also works
  ];
</script>

<div style="height: 100vh;">
  <DomeGallery {images} />
</div>

Customisation

Configure the gallery behaviour with props for sensitivity, animation timing, colours, and more.

<DomeGallery
  images={images}
  segments={35}
  grayscale={false}
  dragSensitivity={15}
  dragDampening={1.5}
  enlargeTransitionMs={400}
  overlayBlurColor="#1a1a2e"
  imageBorderRadius="16px"
  openedImageWidth="400px"
  openedImageHeight="500px"
/>

Props Reference

PropTypeDefaultDescription
images(string | {src, alt})[][]Array of image URLs or objects with src/alt
segmentsnumber35Grid resolution (affects tile count)
grayscalebooleantrueApply grayscale filter to images
fitnumber0.5Radius as fraction of container dimension
fitBasis'auto' | 'min' | 'max' | 'width' | 'height''auto'Which dimension to base radius on
minRadiusnumber600Minimum radius in pixels
maxRadiusnumberInfinityMaximum radius in pixels
dragSensitivitynumber20Drag sensitivity (higher = less sensitive)
dragDampeningnumber2Inertia dampening (0-1, higher = longer coast)
maxVerticalRotationDegnumber5Maximum vertical rotation in degrees
enlargeTransitionMsnumber300Animation duration for enlarge/close
overlayBlurColorstring'#060010'Edge fade/blur overlay colour
imageBorderRadiusstring'30px'Border radius of tile images
openedImageBorderRadiusstring'30px'Border radius of enlarged image
openedImageWidthstring'250px'Width of enlarged image
openedImageHeightstring'350px'Height of enlarged image
padFactornumber0.25Viewer padding as fraction of container

Technical Implementation

3D Sphere Geometry

Items positioned using rotateX/Y and translateZ to place them on a spherical surface. CSS perspective creates depth.

Velocity Tracking

Pointer move events track velocity using time deltas. On release, velocity feeds into inertia animation with configurable friction.

FLIP Animation

Click-to-enlarge uses FLIP technique: First (tile position), Last (enlarged position), Invert, Play for smooth transitions.

ResizeObserver

Responsive radius recalculation on container resize. CSS custom properties updated dynamically for optimal sizing.

Use Cases

🖼️ Portfolio Galleries

Showcase photography, artwork, or design work in an immersive 3D gallery experience.

🛍️ Product Showcases

Display product images in an interactive format that encourages exploration.

🏢 Team Introductions

Creative way to display team member photos on an "About" or company page.

🎭 Event Galleries

Display event photos, conference speakers, or exhibition highlights.

🏠 Real Estate

Property photo galleries with an immersive feel. Each image expands to full view.

📸 Instagram/Social Feeds

Alternative display for social media image grids with a unique 3D presentation.