Skip to content

Instantly share code, notes, and snippets.

@amosgyamfi
Created September 12, 2021 13:40
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/b336959d98e8173c9c98913d05d560df to your computer and use it in GitHub Desktop.
Save amosgyamfi/b336959d98e8173c9c98913d05d560df to your computer and use it in GitHub Desktop.
//
// RaisedHand.swift
// RaisedHand
//
// Created by Amos Gyamfi on 12.9.2021.
//
import SwiftUI
struct RaisedHand: View {
@State private var raised = false
var body: some View {
VStack {
Text("Raised Hand")
.font(.title)
Text("A hand held up showing its palm. May be used to mean stop, or as a high-five.")
.multilineTextAlignment(.center)
Spacer()
ZStack {
if #available(iOS 15.0, *) {
VStack(spacing: 50) {
Image("raised_hand")
.scaleEffect(raised ? 0.4 : 1)
.rotationEffect(.degrees(raised ? -10 : 30))
.animation(.timingCurve(0.68, -0.6, 0.32, 1.6).delay(1).repeatForever(autoreverses: true), value: raised)
/*.animation(.easeInOut(duration: 0.5).delay(0.5).repeatForever(autoreverses: false), value: raised)*/
.task{
raised.toggle()
}
Divider()
Image("raised-hand")
.offset(y: raised ? -20 : 5)
.animation(.easeInOut(duration: 0.5).repeatForever(autoreverses: true), value: raised)
}
} else {
// Fallback on earlier versions
}
}
Spacer()
Spacer()
}
.padding()
}
}
struct RaisedHand_Previews: PreviewProvider {
static var previews: some View {
RaisedHand()
.preferredColorScheme(.dark)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment