1
1
mirror of https://github.com/exyte/Macaw.git synced 2024-10-10 19:37:32 +03:00

Animation fixes

This commit is contained in:
Victor Sukochev 2016-05-12 21:23:35 +06:00
parent b0f331ff73
commit 61e0bd9c43
4 changed files with 8 additions and 5 deletions

View File

@ -232,7 +232,7 @@ class PathExampleView: MacawView {
*/
let n = 200
let n = 40
// let g = 800.0
var clouds = [Node]()
for _ in 0 ... (n - 1) {
@ -243,7 +243,7 @@ class PathExampleView: MacawView {
observableValue: cloud.posProperty,
startValue: Transform.move(0.0, my: 0.0).scale(0.3, sy: 0.3),
finalValue: Transform.move(velocity.x, my: velocity.y).scale(0.3, sy: 0.3),
animationDuration: 1.0)
animationDuration: 4.0)
animation.append(flying)
clouds.append(cloud)
}

View File

@ -75,6 +75,7 @@ public class AnimationProducer {
group.animations = [translationX, translationY, scaleX, scaleY]
group.autoreverses = true
group.repeatCount = 100
group.duration = animation.getDuration()
let layer = ShapeLayer()
// layer.backgroundColor = UIColor.greenColor().CGColor
@ -82,7 +83,9 @@ public class AnimationProducer {
layer.borderColor = UIColor.blueColor().CGColor
if let shapeBounds = shape.bounds() {
layer.frame = shapeBounds.cgRect()
print("Shape bounds: \(shapeBounds.description())")
let cgRect = shapeBounds.cgRect()
layer.frame = CGRectMake(0.0, 0.0, cgRect.width, cgRect.height)
// layer.frame = CGRectMake(0.0, 0.0, 100.0, 100.0)
}

View File

@ -1,7 +1,7 @@
import Foundation
import UIKit
class GroupRenderer: NodeRenderer {
class GroupRenderer: NodeRenderer {
var ctx: RenderContext
var node: Node {
get { return group }

View File

@ -10,6 +10,6 @@ class ShapeLayer: CALayer {
let renderContext = RenderContext(view: .None)
renderContext.cgContext = ctx
GroupRenderer(group: shape, ctx: renderContext, inBounds: true).render()
GroupRenderer(group: shape, ctx: renderContext, inBounds: false).render()
}
}