From 03f3245b7e95d4b3a8b830444e0088ababd22c12 Mon Sep 17 00:00:00 2001 From: Viktor Sukochev Date: Sun, 13 Aug 2017 13:52:35 +0700 Subject: [PATCH] Shape animation initial node fix --- Source/animation/types/ShapeAnimation.swift | 23 ++++++++++++--------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Source/animation/types/ShapeAnimation.swift b/Source/animation/types/ShapeAnimation.swift index fa2e176f..83f8de0c 100644 --- a/Source/animation/types/ShapeAnimation.swift +++ b/Source/animation/types/ShapeAnimation.swift @@ -9,18 +9,21 @@ class ShapeAnimation: AnimationImpl { convenience init(animatedNode: Shape, finalValue: Shape, animationDuration: Double, delay: Double = 0.0, autostart: Bool = false, fps: UInt = 30) { + let nodeId = animatedNode.id let interpolationFunc = { (t: Double) -> Shape in if t == 0 { - return Shape(form: animatedNode.form, - fill: animatedNode.fill, - stroke: animatedNode.stroke, - place: animatedNode.place, - opaque: animatedNode.opaque, - opacity: animatedNode.opacity, - clip: animatedNode.clip, - effect: animatedNode.effect, - visible: animatedNode.visible, - tag: animatedNode.tag) + let initialNode = Node.nodeBy(id: nodeId) as! Shape + + return Shape(form: initialNode.form, + fill: initialNode.fill, + stroke: initialNode.stroke, + place: initialNode.place, + opaque: initialNode.opaque, + opacity: initialNode.opacity, + clip: initialNode.clip, + effect: initialNode.effect, + visible: initialNode.visible, + tag: initialNode.tag) } return finalValue