Flip Clock

Flip Clock

A split-flap clock where each digit is a real 3D flap. The top half falls around the hinge and the bottom half lands with a bounce and cast shadows. Works as a countdown timer or a live clock.

Luiz Mello
  • animation
  • timeline
  • motion

snippet.swift225 lines

3 files • Scroll to see all →
/// A split-flap display. Digits become flip cards and `:` becomes a colon.////// Every card is a real split-flap: the upper half of the old glyph falls/// forward around the hinge (rotation3DEffect), then the lower half of the/// new glyph lands with a little bounce — with shading cast on the halves/// underneath while the flap is in the air.public struct FlipClockDisplay: View {    let text: String    var cardSize: CGSize    var spacing: CGFloat    var haptics: Bool​    public init(_ text: String, cardSize: CGSize = CGSize(width: 64, height: 92), spacing: CGFloat = 6, haptics: Bool = false) {        self.text = text        self.cardSize = cardSize        self.spacing = spacing        self.haptics = haptics    }​    private var glyphs: [(id: Int, char: String)] {​// ... (click "Show full code" to see more)
Viewing: FlipClockDisplay.swift•1 of 3