Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running animation ignoring the view's contentMode #374

Closed
asarmiento13315 opened this issue May 26, 2018 · 4 comments
Closed

Running animation ignoring the view's contentMode #374

asarmiento13315 opened this issue May 26, 2018 · 4 comments
Assignees
Milestone

Comments

@asarmiento13315
Copy link

asarmiento13315 commented May 26, 2018

/*
Hi there,
Before anything, excellent library!

Getting started and making some tests. I haven't been able to find out what I am missing in this case.
Just tried to setup a simple scene interested only on the relative positions, expecting that the SVGView would apply the selected contentMode, scalling and filling in my view.
And all is rendered as expected while the animation is stopped, but, when it begins my animated rect looks like if it hasn't been transformed by the View and its contentMode.

Thank you !
*/

let backg = Rect(x: 0, y: 0, w: 60, h: 60).fill(with: Color.black)
let rect = Group(
contents: [
Line(x1: 0, y1: 0, x2: 20, y2: 0).stroke(fill: Color.blue, width: 3, cap: .round),
Line(x1: 0, y1: 20, x2: 20, y2: 20).stroke(fill: Color.red, width: 3, cap: .round),
Line(x1: 0, y1: 0, x2: 0, y2: 20).stroke(fill: Color.green, width: 3, cap: .round),
Line(x1: 20, y1: 0, x2: 20, y2: 20).stroke(fill: Color.yellow, width: 3, cap: .round)
],
place: Transform.move(dx: 10, dy: 10).scale(sx: 2, sy: 2)
)

let ani = rect.placeVar.animation(angle: 1.99999 * .pi, x: 10, y: 10).cycle().easing(.linear)

let n = [backg, rect].group()
var r = false
n.onTap(f: { _ in
if r { ani.stop() } else { ani.play() }
r = !r
})

let svgView = SVGView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
svgView.node = n

@ystrot ystrot self-assigned this May 31, 2018
@ystrot ystrot added this to the 0.9.2 milestone May 31, 2018
@ystrot
Copy link
Member

ystrot commented May 31, 2018

Actually there are two things with the current release version:

  • There is SVGView which is not intended to be used with a custom node. It's designed for selecting SVG from the storyboard. But it's support contentMode.
  • There is MacawView which you can use with any node, but it's not support contentMode.

However we fixed this issue in the master branch and it will be part of the next release (coming very soon). Now you can use MacawView and it supports contentMode. So please use master version or wait a little bit for the next release.

@asarmiento13315
Copy link
Author

Thanks for answer. Just forget to say I was already using master branch, so the issue may be active yet.

@ystrot
Copy link
Member

ystrot commented Jun 4, 2018

For the master branch just use MacawView instead of SVGView and everything should work fine.

@ystrot
Copy link
Member

ystrot commented Jun 28, 2018

Content mode now supported in the current release version. Please reopen this ticket if you still have some issues.

@ystrot ystrot closed this as completed Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants