Animated Like Button

Animated Like Button

A premium like button: keyframed squash-and-stretch, a shockwave ring with two-tone spark burst, rolling numeric count, soft deflate on unlike, and double-tap-to-like with a big heart popping over media. Ships heart, star and bookmark presets on the same engine, with haptics and VoiceOver support.

Luiz Mello
  • button
  • animation
  • interaction

snippet.swift479 lines

8 files • Scroll to see all →
/// The look of an `AnimatedLikeButton`: which symbol it uses, its gradient,/// and the colors of the sparks it throws. Use a preset or build your own.public struct AnimatedLikeStyle {    public var symbol: String    public var filledSymbol: String    /// Gradient for the filled icon and the ring (top-leading → bottom-trailing).    public var colors: [Color]    /// Colors cycled through by the spark particles.    public var sparks: [Color]    /// VoiceOver name, e.g. "Like".    public var label: String​    public init(symbol: String, filledSymbol: String, colors: [Color], sparks: [Color], label: String) {        self.symbol = symbol        self.filledSymbol = filledSymbol        self.colors = colors.isEmpty ? [.accentColor] : colors        self.sparks = sparks.isEmpty ? self.colors : sparks        self.label = label    }​​// ... (click "Show full code" to see more)
Viewing: Style.swift•1 of 8