Created
September 22, 2020 13:21
-
-
Save amosgyamfi/d2ad3586cb9b206d33bd0b8097d6204b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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