commit 3c02c00aa3a7f27ce8dd61c28e30c9be62c585ca
parent 61a6d166d95a747e7fdc6432bba0b0282940d5cc
Author: Marc Stibane <marc@taler.net>
Date: Mon, 31 Mar 2025 06:52:15 +0200
debug animations
Diffstat:
4 files changed, 44 insertions(+), 24 deletions(-)
diff --git a/TalerWallet1/Helper/Animations.swift b/TalerWallet1/Helper/Animations.swift
@@ -17,33 +17,53 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-
+/**
+ * @author Marc Stibane
+ */
import SwiftUI
var debugAnimations = false
extension Animation {
- static var shake: Animation {
- if debugAnimations {
- return Animation.easeInOut(duration: 2.0)
- } else {
- return Animation.interactiveSpring(response: 0.6, dampingFraction: 0.6, blendDuration: 0.25)
- }
+#if DEBUG
+ static var debug: Animation {
+ Animation.easeInOut(duration: 2.0)
}
-
- static var fly: Animation {
- if debugAnimations {
- return Animation.easeInOut(duration: 2.0)
- } else {
- return Animation.interactiveSpring(response: 0.6, dampingFraction: 0.6, blendDuration: 0.25)
- }
+#endif
+
+ static var spring1: Animation {
+ Animation.interactiveSpring(response: 0.6, dampingFraction: 0.6, blendDuration: 0.25)
+ }
+
+ static var easeIn1: Animation {
+#if DEBUG
+ debugAnimations ? Animation.debug : Animation.easeIn(duration: 0.25)
+#else
+ Animation.easeIn(duration: 0.25)
+#endif
+ }
+
+ static var shake1: Animation {
+#if DEBUG
+ debugAnimations ? Animation.debug : Animation.spring1
+#else
+ Animation.spring1
+#endif
+ }
+
+ static var fly1: Animation {
+#if DEBUG
+ debugAnimations ? Animation.debug : Animation.spring1
+#else
+ Animation.spring1
+#endif
}
- static var basic: Animation {
- if debugAnimations {
- return Animation.easeInOut(duration: 2.0)
- } else {
- return Animation.default
- }
+ static var basic1: Animation {
+#if DEBUG
+ debugAnimations ? Animation.debug : Animation.default
+#else
+ Animation.default
+#endif
}
}
diff --git a/TalerWallet1/Views/OIM/OIMcurrencyScroller.swift b/TalerWallet1/Views/OIM/OIMcurrencyScroller.swift
@@ -30,7 +30,7 @@ struct OIMcurrencyScroller: View {
// }
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(ms)) {
print("shake end")
- withAnimation(. shake) {
+ withAnimation(. shake1) {
shake = false
amountVal += value
tappedVal = 0
diff --git a/TalerWallet1/Views/OIM/OIMcurrencyViews.swift b/TalerWallet1/Views/OIM/OIMcurrencyViews.swift
@@ -174,7 +174,7 @@ struct OIMnoteStackV: View {
.matchedGeometryEffect(id: id, in: namespace, isSource: false)
.onAppear {
print("start flying \(id), shaking \(shakeOffset)")
- withAnimation(.fly) {
+ withAnimation(.fly1) {
isFlyingToDeck = true
}
}
diff --git a/TalerWallet1/Views/OIM/OIMlineViews.swift b/TalerWallet1/Views/OIM/OIMlineViews.swift
@@ -39,7 +39,7 @@ struct OIMnotesView1: View {
shake: shake,
canEdit: canEdit
) {
- withAnimation(.basic) {
+ withAnimation(.basic1) {
amountVal -= value // remove on button press
}
}
@@ -70,7 +70,7 @@ struct OIMcoinsView1: View {
count: count,
currency: currency,
canEdit: canEdit) {
- withAnimation(Animation.easeIn(duration: 0.25)) {
+ withAnimation(Animation.easeIn1) {
amountVal -= value
}
}