Begin on animation after one ends

I have two paths I'm trying to animate in one continuous motion (one after the other). I'm drawing a circle and trying to follow that up with a line.

@State private var revealStroke = false

Path { path in
                path.addArc(center: CGPoint(x: 100, y: 100), radius: CGFloat(50), startAngle: Angle(degrees: 0), endAngle: Angle(degrees: 360), clockwise: true)
                path.addLines([CGPoint(x: 200, y: 100), CGPoint(x: 150, y: 100)])
            }
            .trim(from: revealStroke ? 0 : 1, to: 1)
            .stroke(Color.purple, lineWidth: 3)
            .animation(Animation.easeOut(duration: 3))
            .onAppear() {
                self.revealStroke.toggle()
            }


Read more here: https://stackoverflow.com/questions/66997069/begin-on-animation-after-one-ends

Content Attribution

This content was originally published by cjay at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: