Questions tagged [swiftui-animation]
228 questions
0
votes
1 answer
Animate a view in SwiftUI without a state-variable?
I’m learning SwiftUI right now and have gotten to animations, which so far only seem to work with a state-change by some kind of user interaction.
Is it possible to have a looping animation playing as soon as the view loads? I want to animate some…

irrbloss
- 207
- 2
- 9
0
votes
0 answers
Wrap frame after rotation3DEffect modifier
I have a view that is two halves of an Image, which I'm attempting to make a folding accordion style animation. As the viewed angle increases towards 90 degrees, the view should be increasingly closer to a height of 0.
struct HeroModuleView: View {
…

xTwisteDx
- 2,152
- 1
- 9
- 25
0
votes
0 answers
How to make a .transition in Swift with value of time animation?
I have code like this in my ContentView:
I want to make this transition slow than now, it looks like this right know, but animation is too fast. I don't know how to do it. Type of AnyTransition doesn't have something like value or duration…

lovemyreves
- 1
- 1
0
votes
0 answers
Views in SwiftUI array are not being animated upon request
I'm making this app that rolls random dice. I have a custom object that defines one dice object view. This object has two functions that start and stop an animation on the view. When calling this regularly, they work, but the issue is that when I…

ToxicFlame427
- 355
- 2
- 13
0
votes
1 answer
Why does AnyTransition.opacity work with animation while AnyTransition.offset fails
using the code below as an example
let shootUp = AnyTransition.opacity.animation(.easeIn(duration: 5))
opacity works & can be delayed by changing the duration
let shootUp = AnyTransition.offset(x: 0, y: -1000).animation(.easeIn(duration:…

byaruhaf
- 4,128
- 2
- 32
- 50
0
votes
0 answers
Why is my SwiftUI custom drawer overlay animation jittery when I'm not scrolling in a ScrollView?
Running into some weird behavior with the SwiftUI rendering engine and I'm wondering if anyone can shed some light into it.
For context, I'm creating a custom Drawer View using an overlay. The specific animation in question is the drawer view moving…

sadel
- 31
- 7
0
votes
1 answer
SwiftUI LinearGradient Color Change With Animation Happens Instantly
I am trying to animate a gradient change but it keeps happening instantly rather than animating. My current code is as follows
struct GradientView: View {
@State var currentTopColor = Color.white
var body: some View {
…

Aggressor
- 13,323
- 24
- 103
- 182
0
votes
0 answers
Can SwiftUI .zIndex visual attribute be animated with withAnimation? (as every other View visual parameter seem to be?)
I've been banging my head against some strange (or not) SwiftUI .zIndex animation issue:
I can't see how to animate the .zIndex View parameter of a random view (as I seem to be able to do it with .scaleEffect, .position, .rotation, etc...)
Is it a…

Isaac
- 1,794
- 4
- 21
- 41
0
votes
0 answers
SwiftUI Animation is not working properly when it’s in a stack
I'm trying to make a car animation by composing some view. First I gave an animation rotationeffect with 0.5 speed to the tire so it would rotate. Then I put the car body and tire into a zstack.
struct CarBodyView: View {
var body: some View {
…

Deuniru
- 39
- 1
- 5
0
votes
0 answers
SwiftUI / Spritekit image looping issue
I'm trying to make an image of the size 183x250 loop infinitely while speeding up.
Looping is fine if it doesnt speed up, however if I speed it up by reducing the duration of TimeInterval the image doesn't get stitched and breaks.
import…
0
votes
1 answer
Countdown timer in SwiftUI
I'm trying to implement a countdown view in SwiftUI as follows:
struct CountdownView: View {
private let duration: Double
private let period: Double
@State
var timeRemaining: Double = 20.0
init(duration: Double,…

Overpass
- 433
- 5
- 12
0
votes
0 answers
iOS16. How to disable NavigationLink animation?
Is it possible to disable NavigationLink transition animation in SwiftUI?
To be more precisely. I want to disable it only for a few links/views. Not the whole app

breq
- 24,412
- 26
- 65
- 106
0
votes
2 answers
How to make blink effect in SwiftUI?
I want to write my own button style which behaves like those in macOS menu list.
As it shown below, after click, its background changed: blue -> transparent -> blue, and then disappear. And they all happen after releasing, so I don't think…

Yiming Designer
- 423
- 3
- 10
0
votes
0 answers
SwiftUI Transition Animation is Applied to Elements Inside View Separately
I'm having a very strange issue with my SwiftUI transitions/animations. My intention is to slide whole views in/out, but it seems like the animation is applied to the elements inside of the view separately as well as the whole view. The result is…

George B
- 918
- 3
- 15
- 24
0
votes
1 answer
Animated a listRowBackground gradient?
I have a view that looks like this:
I would like to animate the gradient in the listRowBackground, but I am not able to for some reason. Here is the code I have:
import SwiftUI
struct SnakeColorView: View {
@AppStorage("HeadColor") private var…

Ness Earthbound
- 25
- 4