Skip to content

holgerkrupp/KenBurns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Apply the .kenBurns() modifier to any Image or View you want to animate. Ensure the view has a size defined by its parent container (e.g., a .frame() or VStack/HStack constraint).

import SwiftUI
import KenBurns

struct ContentView: View {
    var body: some View {
        Image("CoolImage")
            .resizable()
            .scaledToFill() // Optional: Ensures it covers the frame completely
            .frame(width: 400, height: 400) // Define the frame for the animation area
            
            // Apply the Ken Burns effect
            .kenBurns(duration: 15.0, maxScale: 1.3)
            
            .clipped() // Important to prevent overflow
    }
}

About

A simple KenBurns Effect for SwiftUI Views

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages