Skip to content

An animated liquid shape for SwiftUI.

Notifications You must be signed in to change notification settings

ValentinWalter/LiquidShape

Repository files navigation

Preview GIF

LiquidShape

An animated liquid shape for SwiftUI.

Preview Xcode Canvas

import SwiftUI
import LiquidShape

struct MyView: View {
  var body: some View {
    Liquid()
      .foregroundColor(.blue)
    
    // or
    Liquid(speed: 0.5)
  }
}

Advanced

For advanced use, check out the Shape itself.

Preview Xcode Canvas

TimelineView(.animation) { ctx in
  Liquid.Shape(
    time: 4 * ctx.date.timeIntervalSince1970,
    scale: 12 * .pi,
    amplitude: 20,
    contentMode: .contain,
    resolution: .pi / 2
  )
}

Preview Xcode Canvas

To experiment with parameters, use the included debug view.

Liquid.debug()

Install

LiquidShape is a Swift Package. Add via Xcode File > Add Packages... or drop this in your Package.swift dependencies:

.package(url: "https://github.com/ValentinWalter/LiquidShape/", from: "1.0.0")