-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
04a3fb6
commit ee3fa0d
Showing
8 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
Binary file modified
BIN
-2.23 KB
(98%)
...proj/project.xcworkspace/xcuserdata/tahatesser.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
21 changes: 21 additions & 0 deletions
21
SwiftUIPlayground/Assets.xcassets/Joker.imageset/Contents.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Joker.jpg", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
SwiftUIPlayground/Assets.xcassets/Red_Deck.imageset/Contents.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Red_Deck.jpg", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
This file contains 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
41 changes: 41 additions & 0 deletions
41
SwiftUIPlayground/Samples/View/FlipperAnimationSample.swift
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// FlipperAnimationSample.swift | ||
// SwiftUIPlayground | ||
// | ||
// Created by Taha Tesser on 05.01.2025. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct FlipperAnimationSample: View { | ||
@State private var timer: Timer? | ||
@State private var flipped: Bool = false | ||
|
||
var body: some View { | ||
ZStack { | ||
Image(.joker) | ||
.rotation3DEffect(.degrees(flipped ? -180 : 0), axis: (x: 1.0, y: 0.0, z: 0.0)) | ||
.opacity(flipped ? 0 : 1) | ||
|
||
Image(.redDeck) | ||
.rotation3DEffect(.degrees(flipped ? 0 : 180), axis: (x: 1.0, y: 0.0, z: 0.0)) | ||
.opacity(flipped ? 1 : 0) | ||
} | ||
.onAppear { | ||
timer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { _ in | ||
|
||
withAnimation(.spring(response: 0.6, dampingFraction: 0.7, blendDuration: 0.2)) { | ||
flipped.toggle() | ||
} | ||
} | ||
} | ||
.onDisappear { | ||
timer?.invalidate() | ||
timer = nil | ||
} | ||
} | ||
} | ||
|
||
#Preview { | ||
FlipperAnimationSample() | ||
} |