Skip to content

Instantly share code, notes, and snippets.

@amosgyamfi
Created September 22, 2020 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amosgyamfi/d2ad3586cb9b206d33bd0b8097d6204b to your computer and use it in GitHub Desktop.
Save amosgyamfi/d2ad3586cb9b206d33bd0b8097d6204b to your computer and use it in GitHub Desktop.
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
@State private var beating = false
var body: some View {
Image(systemName: "heart.fill")
.font(.system(size: 128))
.foregroundColor(Color(beating ? .systemPink : .systemRed))
.scaleEffect(beating ? 1 : 1.25)
.animation(Animation.interpolatingSpring(stiffness: 30
, damping: 15).repeatForever(autoreverses: false))
.onAppear(){
self.beating.toggle()
}
}
}
let ContentView_Previews = ContentView()
let vc = UIHostingController(rootView: ContentView_Previews)
PlaygroundPage.current.liveView = vc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment