1
1
mirror of https://github.com/exyte/Macaw.git synced 2024-10-26 13:01:25 +03:00

Rotation fix

This commit is contained in:
Victor Sukochev 2016-09-07 16:41:01 +06:00
parent 04ac18f95e
commit 04e5d57991
2 changed files with 4 additions and 4 deletions

View File

@ -117,13 +117,13 @@ class PathExampleView: MacawView {
)
}
initialTransform = Transform().move(dx: -50.0, dy: 30.0) // .scale(sx: 0.5, sy: 0.5)
initialTransform = Transform().move(dx: -50.0, dy: 30.0).scale(sx: 0.5, sy: 0.5)
sceneGroup = Group(contents: [cloudExample()])
sceneGroup.place = initialTransform
let rotation = GeomUtils.centerRotation(node: sceneGroup, angle: M_PI_4)
let superposition = GeomUtils.concat(t1: initialTransform, t2: rotation)
animation = sceneGroup.placeVar.animation((initialTransform >> initialTransform.scale(sx: 0.5, sy: 0.5)).t(10.0))
animation = sceneGroup.placeVar.animation((initialTransform >> initialTransform.rotate(angle: M_PI_4)).t(10.0))
// let test = Text(text: "Hello World!", place: .move(dx: 100, dy: 100))
super.init(node: sceneGroup, coder: aDecoder)
@ -144,6 +144,6 @@ class PathExampleView: MacawView {
}
func updateScale(scale: Float) {
sceneGroup.place = initialTransform.scale(sx: Double(scale), sy: Double(scale))
sceneGroup.place = initialTransform.rotate(angle: M_PI_4 * Double(scale))
}
}

View File

@ -89,7 +89,7 @@ func transformAnimationByFunc(node: Node, valueFunc: (Double) -> Transform, dura
let sx = a / fabs(a) * sqrt(a * a + b * b)
let sy = d / fabs(d) * sqrt(c * c + d * d)
let angle = atan2(-1.0 * b, a)
let angle = atan2(b, a)
timeValues.append(t)
xValues.append(CGFloat(dx))