Parallax Carousel

Parallax Carousel

A snapping paging carousel where neighbors shrink and swing back in 3D while each card's artwork drifts in parallax. The page indicator stretches continuously with the scroll.

Luiz Mello
  • carousel
  • motion
  • gallery

snippet.swift260 lines

7 files • Scroll to see all →
/// One page of a `ParallaxCarousel`. The "photo" is a mesh gradient with a/// large SF Symbol, so the snippet needs no image assets.public struct ParallaxCarouselSlide: Identifiable, Hashable {    public let id: String    let title: String    let subtitle: String    let systemImage: String    /// 9 colors for a 3×3 mesh gradient.    let colors: [Color]​    public init(title: String, subtitle: String, systemImage: String, colors: [Color]) {        precondition(colors.count == 9, "ParallaxCarouselSlide needs 9 colors (3×3 mesh).")        self.id = title        self.title = title        self.subtitle = subtitle        self.systemImage = systemImage        self.colors = colors    }}
Viewing: Model.swift•1 of 7