exyte / Macaw

Powerful and easy-to-use vector graphics Swift library with SVG support
MIT License
6.02k stars 560 forks source link

Animating shape inside an SVG #758

Open miguelc95 opened 3 years ago

miguelc95 commented 3 years ago

Hi! I have been using it to change colors and moving shapes inside an SVG based on some calculations and it's been working perfectly, however I try the following:

let trainNode = self.mapView.node.nodeBy(tag: "train1")
let trainShape = trainNode as! Shape
trainShape.fill = Color.blue
let move = Transform.move(dx: currentStation.path.last!.first! - 15, dy: currentStation.path.last!.last! - 20)
trainShape.placeVar.animate(from: trainShape.place, to: move, during: 10, delay: 0)

But disappears and just appears at the finishing place instead of animatedly moving to it

How could I achieve this?

I also tried with:

animate(along: Path) But the same thing occurs, it just shows up at the end of the path

Thanks in advance and great project!