Understanding Layer Hierarchy
What is a Layer Hierarchy?
A layer hierarchy is a parent-child relationship between layers:- Parent layers can contain child layers (called sublayers)
- Sublayers inherit transformations from their parent layer
- Sublayers can be nested multiple levels deep
In CAPlayground, there are no dedicated “group” layers. Any layer can act as a parent and contain sublayers.
Creating Sublayers
How to Add Sublayers
To create a sublayer inside an existing layer:- Select the parent layer in the Layers Panel or Canvas
- Click Add Layer and choose a layer type
- The new layer will be created as a sublayer of the selected layer
Removing Sublayers
To move a sublayer back to the root level:- Drag the sublayer from the Layers Panel
- Drop it outside its parent (above or below other root layers)
- The layer becomes a root layer again
Using Sublayers that act like a Container
What Are Containers?
Since any layer can have sublayers, you can create a so called container layer to organize related elements: Common approaches:- Create a Basic Layer and set its opacity to 0% to make it invisible
- Create a Transform Layer (CATransformLayer) for gyro wallpapers
- Add other layers as sublayers
- The container layer acts as a parent
- Organization: Group related layers together
- Batch transformations: Move multiple layers at once
- Gyro effects: Use Transform Layers to make sublayers respond to device tilt
Transform Layers (CATransformLayer) are specialized containers for gyro wallpapers. Learn more about Gyro Effects → or Building in 3D →
How Sublayers Inherit Transformations
Position
Sublayer positions are relative to their parent:- If a parent is at position (100, 100)
- And a sublayer is at position (50, 50)
- The sublayer appears at (150, 150) on the canvas
Advanced Properties
Flip Geometry
Controls the coordinate system for sublayers: Location: Geometry tab in the Inspector Values:- Off: Bottom-left origin
- On: Top-left origin
- Changes how sublayer positions are calculated
- Affects the Y-axis direction for sublayers
- Useful when importing designs from different coordinate systems
- With Flip Geometry off: Y increases upward (0 at bottom)
- With Flip Geometry on: Y increases downward (0 at top)
Flip Geometry only affects the layer’s sublayers, not the layer itself.
Clip Contents
Controls whether sublayers are clipped to the parent’s bounds: Location: Compositing tab in the Inspector Values:- Off: Sublayers can extend beyond the parent’s bounds (default)
- On: Sublayers are clipped to the parent’s bounds
- When on, sublayers are masked to the parent’s rectangular area
- Useful for creating “window” effects
Next Steps
Creating Layers
Learn how to create different types of layers
Editing Layers
Master layer properties and editing
Creating Animations
Animate groups and sublayers
Transform Layers (Gyro)
Create gyro wallpapers with device tilt effects
