0

I'am displaying a text whose value is changed based on a different value, this is how I implemented it:

Text((skateGame.getState() == .player1Set || skateGame.getState() == .player1Try) ?
                   skateGame.getPlayer1().getName() : skateGame.getPlayer2().getName())
    .font(.system(size: width * 0.08, weight: .bold, design: .rounded))
    .foregroundColor(Color.white)
    .padding(.top, height * 0.02)
    .padding(.bottom, height * 0.02)

How can I animate the transition between the values? For example with a bouncing motion or a fade in and out?

4
  • Would you show code of skateGame type? The problem might be in observing/updating view. Commented Jan 20, 2021 at 14:04
  • The text is updated without a problem, but it just flicks from one value to the next without any nice transition. Commented Jan 20, 2021 at 14:08
  • Does this answer help? Commented Jan 20, 2021 at 23:15
  • No sorry tried this before. Commented Jan 22, 2021 at 19:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.