I'm new to SwiftUI, but I have a good knowledge about Storyboard.
At the beginning I want to start with some animations, but I have a problem with one of them:
- I want an image to become the size 50x50 from 0x0 at the beginning.
- AFTER it is 50x50 it should repeat an animations that makes the size 50x50 -> 40x40 -> 50x50 -> ... forever
I know @State variables, the .onAppear event, repeating animations with the autoreverse bool, but I don't know how to use them to become the best resolution.
I hope that someone can help me.
@State var element_appeared : Bool = false
Image(systemName: "paperplane.fill")
.resizable()
.frame(width: element_appeared ? 50 : 0, height: element_appeared ? 50 : 0)
.onAppear() {
element_appeared.toggle()
}
.animation(.easeInOut)
This is how the animation at the beginning works. I think that I have to work on the element_appeared variable, but I really don't know how..