We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After stopping animation I am expecting to see the line at place (dx: 0, dy: 0)
import Foundation import Macaw class StudioView: MacawView { required init?(coder aDecoder: NSCoder) { super.init(node: Group(contents: []), coder: aDecoder) let line = Shape( form: Line( x1: 0, y1: -2, x2: Double(self.bounds.width), y2: 0 ), stroke: Stroke(fill: Color.red, width: 3.0) ) let playBtn = Shape( form: Rect( x: Double(self.bounds.width) / 2 - 50, y: Double(self.bounds.height) / 2 - 50, w: 100, h: 100 ), fill: Color.red ) let text = Text( text: "START", align: .mid, place: Transform.move( dx: (Double(self.bounds.width) / 2), dy: (Double(self.bounds.height) / 2) ), opaque: false ) let lineAnimation = line.placeVar.animation(to: Transform.move(dx: 0, dy: Double(self.bounds.height)), during: 3.0).easing(Easing.linear).cycle() var count: Int = 0 playBtn.onTap { _ in if count % 2 == 0 { count = count + 1 print("START!") lineAnimation.play() text.text = "STOP" } else { print("STOP!") text.text = "START" lineAnimation.stop() line.place = Transform.move(dx: 0, dy: 0) } } self.node = [playBtn, text, line].group() } }
The text was updated successfully, but these errors were encountered:
Fixed, now we have pause and stop methods.
pause
stop
Sorry, something went wrong.
vhailor13
No branches or pull requests
After stopping animation I am expecting to see the line at place (dx: 0, dy: 0)
The text was updated successfully, but these errors were encountered: