HomeiOS Developmentios - Mixed picture change and motion animation would not play correctly

ios – Mixed picture change and motion animation would not play correctly


Having easy code like beneath, the animation of adjusting the picture and motion shouldn’t be displayed correctly. The picture shouldn’t be shifting along with the entire view, however fades out after which fades in within the vacation spot spot. Please see the picture.

struct AnimationTestView: View {
    @State var chosen: Bool = false
    
    var physique: some View {
        HStack {
            if !chosen {
                Picture(systemName: "plus.circle")
                    .resizable()
                    .body(width: 50, peak: 50)
                    .background(Colour.inexperienced)
            }
            
            Picture(systemName: chosen ? "plus.circle.fill" : "plus.circle")
                .resizable()
                .body(width: 50, peak: 50)
                .background(Colour.yellow)
                .onTapGesture {
                    withAnimation {
                        chosen.toggle()
                    }
                }
            Spacer()
        }
    }
}

enter image description here

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments