Get your own website
Demo.swift
ContentView.swift
App.swift
 
import SwiftUI

struct CurvesDemo: View {
  @State private var x: CGFloat = 0
  var body: some View {
    VStack(spacing: 12) {
      HStack { Circle().frame(width: 24, height: 24).offset(x: x); Spacer() }
      HStack(spacing: 12) {
        Button("EaseIn") { withAnimation(.easeIn(duration: 1)) { x = 240 } }
        Button("EaseOut") { withAnimation(.easeOut(duration: 1)) { x = 0 } }
      }
    }
    .padding()
  }
}

                    
import SwiftUI

struct ContentView: View {
  var body: some View { CurvesDemo() }
}

                    
import SwiftUI

@main
struct MyApp: App {
  var body: some Scene { WindowGroup { ContentView() } }
}