Skip to content

Instantly share code, notes, and snippets.

@georgecartridge
Created June 27, 2025 10:54
Show Gist options
  • Select an option

  • Save georgecartridge/7a97b8b89e7243a8a7a9aa43d97512eb to your computer and use it in GitHub Desktop.

Select an option

Save georgecartridge/7a97b8b89e7243a8a7a9aa43d97512eb to your computer and use it in GitHub Desktop.
This is a staggered text animation based on the Arc onboarding intro - using the AnimateText swift package (https://github.com/jasudev/AnimateText)
public struct StaggerTextEffect: ATTextAnimateEffect {
public var data: ATElementData
public var userInfo: Any?
public init(_ data: ATElementData, _ userInfo: Any?) {
self.data = data
self.userInfo = userInfo
}
public func body(content: Content) -> some View {
content
.opacity(data.value)
.blur(radius: 10 - 10 * data.value)
.rotation3DEffect(Angle(degrees: 20 * data.invValue), axis: (x: 0, y: 0, z: 1), anchor: .bottomLeading, anchorZ: 0, perspective: 0.7)
.offset(x: 0, y: data.invValue * (data.size.height * 1))
.animation(.spring(duration: 0.6, bounce: 0.26).delay(Double(data.index) * 0.02), value: data.value)
}
}
@georgecartridge
Copy link
Author

You can then use it in a view:

AnimateText<StaggerTextEffect>($text, type: .letters)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment