Home > Blockchain >  How to make animation slower SwiftUI
How to make animation slower SwiftUI

Time:07-23

    Button("forward") {
        withAnimation(.easeInOut.delay(1)) {
            isForward.toggle()
        }
    }

I tried to make my animation slower and smoother however the result i got is freezed animation.

My second try was lowering down the delay value to 0.7 but it did not work too.

CodePudding user response:

Change from .delay to .speed instead. Lower value = slower speed.

withAnimation(.easeInOut.speed(0.5)) {
        isForward.toggle()
}

CodePudding user response:

I think you just wanted to change duration

Button("forward") {
    withAnimation(.easeInOut(duration: 1)) {   // << here !!
        isForward.toggle()
    }
}
  • Related