exyte / Macaw

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

Scale node of svg #690

Open Dreagvor opened 4 years ago

Dreagvor commented 4 years ago

how can I scale node of svg image?

after this block of code i'm not getting my layer scaled, but getting translated by poing

self.node.nodeBy(tag:   nodeTag)?.onTouchPressed({ [unowned self] (touch) in
            guard let nodeShape = self.node.nodeBy(tag: nodeTag) as? Shape else { return }

            let animation = nodeShape.placeVar.animation(to: Transform.scale(sx: 2, sy: 2), during: 0.4)

            animation.play()
        })
ystrot commented 4 years ago

Hi @Dreagvor,

Make sure you take into account your current place. For example, you can use:

let animation = nodeShape.placeVar.animation(to: nodeShape.place.scale(sx: 2, sy: 2), during: 0.4)