Snippet

import SwiftUI

struct ContentView: View {
    @State private var reveal = false

    var body: some View {
        ZStack {
            Color.black.ignoresSafeArea()

            Text("SWIFTUI")
                .font(.system(size: 65, weight: .black, design: .rounded))
                .foregroundStyle(.white)
                .mask {
                    LinearGradient(
                        colors: [.clear, .white, .clear],
                        startPoint: .leading,
                        endPoint: .trailing
                    )
                    .frame(width: 180)
                    .offset(x: reveal ? 260 : -260)
                }
        }
        .onAppear {
            withAnimation(.easeInOut(duration: 1.6).repeatForever(autoreverses: false)) {
                reveal = true
            }
        }
    }
}

Preview

Simulator Screen Recording - iPhone 17 Pro - 2026-05-22 at 17.36.45.gif

How to tweak it?

Tweak duration for animation immediacy effect

withAnimation(.easeInOut(duration: 0.9) decrease duration for slower progression
Simulator Screen Recording - iPhone 17 Pro - 2026-05-22 at 18.08.57.gif
or decrease it for calm rolling reveal withAnimation(.easeInOut(duration: 4.6)
Simulator Screen Recording - iPhone 17 Pro - 2026-05-22 at 18.05.33.gif


TAGS

SHARE VIA

RELATED POSTS