Skip to content

Coordinate Space

Luke Zhao edited this page Feb 24, 2017 · 3 revisions

Global Coordinate Space (default before 0.1.3)

Animating views are not affected by parent views' attributes. Does not move with the parent view. I.e. They are being taken out of the view hierarchy once heroModifiers are applied. Use useGlobalCoordinateSpace modifier to force this behavior after 0.1.3.

Local Coordinate Space (default after 0.1.3)

Animating views moves along with its parent view. Note that when a view is matched, or when source or useGlobalCoordinateSpace modifiers are used, the view will go back to global coordinate space.

For the examples above, the following heroModifiers are applied.

greyView.heroModifiers = [.translate(y:100)]
blackView.heroModifiers = nil
redView.heroModifiers = [.translate(x:50)]

When using local coordinate space, the view is contained inside a global coordinate spaced view. Other global spaced view might appear on top of these local spaced views. If you want a view to appear on top of another global spaced view, you will have to change it to global spaced as well by using the useGlobalCoordinateSpace modifier.