Questions tagged [swiftui-animation]

228 questions
1
vote
1 answer

Is there any way to remove the fading animation on .onDelete SwiftUI

The code is below. I want to delete the final fading animation when onDelete is tapped. struct ContentView: View { @State var names = ["david", "john", "amber"] var body: some View { List { ForEach(names, id: \.self)…
1
vote
1 answer

SwiftUI unexpected position changes during animation

I have made a simple animation in SwiftUI which repeats forever, directly when starting the app. However when running the code the animated circle goes to the left top and then back to its normal position while doing the rest of the animation. This…
ARR
  • 2,074
  • 1
  • 19
  • 28
1
vote
0 answers

Animation affects whole hierarchy

I have a very simple piece of code that shows correctly in the swiftui static preview, and runs correctly in iOS. However when I select the macOS target and the live preview, The entire hierarchy moves repeatedly down from the top corner. This is…
TirantFox
  • 11
  • 2
1
vote
1 answer

matchedGeometryEffect not always animates the position changes

My goal is to simulate a pawn that jumps from square to square. struct MyView: View { @State var current = 0; @State var colors : [Color] = [.blue, .gray, .red] @Namespace var animationNamespace : Namespace.ID var body : some View { …
fdelsert
  • 768
  • 1
  • 10
  • 22
1
vote
1 answer

Swap two elements onTapGesture with zIndex updated for the animated transition

I use matchedGeometryEffect and TapGesture to swap two elements with animated transition. The animation works as expected but I want to change the zIndex of the elements for the duration of the animation. I started from this example :…
fdelsert
  • 768
  • 1
  • 10
  • 22
1
vote
1 answer

Animate SwiftUI TextEditor Text

I would like to add animation so that when I click a button, the text inside my TextEditor (in iOS 14) fades out slowly (let's say with a duration of 1.5). This is the code I am working with, but cannot get the text to fade out. Any ideas of what I…
Sharanjit
  • 11
  • 1
1
vote
1 answer

Why isn't my SwiftUI transition animating?

I have a view based on a few state variables. These states are set by the completion block of an API call. The bookings are displayed as a ForEach list and I want them to appear with the slide transition. The slide transition worked perfectly. Since…
Ferdz
  • 1,182
  • 1
  • 13
  • 31
1
vote
1 answer

SwiftUI views inserted with ForEach not updating with animation

I created a simple function that inserts three Buttons. I want an individual button to rotate when pressed. My initial try was this: ForEach(0..<3, id: \.self) { number in { Button(action: { self.flagTapped(number: index) …
Scooter
  • 4,068
  • 4
  • 32
  • 47
1
vote
0 answers

Multiple animations do not work as expected in SwiftUI

I want to create a pulsing circle with forever repeating animation. It should have a gradual change of size and a momentary change of color when animation direction changes. I have two different animations for that, but only the last one having an…
1
vote
0 answers

SwiftUI AnyTransition.animation not overriding animation parameters when using .offset

I have a view in which I would like to use the offset transition. It is my understanding that I can use the .animation function on AnyTransition to override the animation parameters of an explicit animation. In this simple example, I would like the…
SG001
  • 11
  • 1
1
vote
1 answer

How add dependency animation between multiple view in SwiftUI?

I want to achieve animation for dot progress with SwiftUI. I think we need to add dependency between each dot animation with another dot animation and, with such dependency, we can achieve the below animation! Reference I try with the below code…
Ashish
  • 2,977
  • 1
  • 14
  • 32
1
vote
1 answer

Initial SwiftUI Animation inside ScrollView

In my app I have a ScrollView that holds a VStack. The VStack has an animation modifier. It also has one conditional view with a transition modifier. The transition works. However, when the view first appears, the content scales up with a starting…
Yannick
  • 3,210
  • 1
  • 21
  • 30
1
vote
1 answer

Animated transitions and contents within ScrollView in SwiftUI

I'm not quite a SwiftUI veteran but I've shipped a couple of apps of moderate complexity. Still, I can't claim that I fully understand it and I'm hoping someone with deeper knowledge could shed some light on this issue: I have some content that I…
Baglan
  • 1,057
  • 10
  • 23
1
vote
1 answer

Animation with delay instead of using timer

I have several Circles in swiftui, that react on a touchgesture. I want them to increase the opac value and afterwards decrease it again: HStack { Spacer(minLength: 20.0) Circle() //#e74c3c .foregroundColor(Color(red: 231.0/255.0,…
MrSpock
  • 19
  • 2
1
vote
1 answer

SwiftUI animate all except .foregroundColor

Based on the value of a @State var, how can I animate any other parameters but one? For instance, I want to animate .offset but not the .foregroundColor. It may sound like an easy task to do, but it's not so easy when using the same "base view" to…
Aнгел
  • 1,361
  • 3
  • 17
  • 32