Nothing

Level 1 spatial composition

Local coordinates, cameras, group isolation and compositing.

Read as Markdown

A shape, group, or sequence can place its visual result in the coordinates of its parent. A single drawable owns its own transform. When several children move together, a group can own the shared transform and leave the children's coordinates editable.

Cameras

A scene can declare one or more named camera children. Cameras consume no paint slot. Each id is nonempty, case-sensitive, and uses only ASCII letters, digits, underscores or hyphens. IDs are unique within the scene. With cameras present, the scene supplies a camera attribute naming its base view. A scene without cameras uses the identity view. Diagnose a missing base selector, a duplicate ID or a selector value that names no camera in the same scene. Scene vocabulary

Camera attributeDefaultMeaning
center-x, center-yCorresponding coordinate of viewport centerPoint in scene coordinates framed at viewport center.
zoom1Strictly positive magnification from scene units to viewport units.
roll0Clockwise rotation of the camera axes in degrees.

The camera's numeric attributes take scalar property tracks on the scene's clock. Changing scene.camera takes held key segments with camera IDs as values. At an exact cut instant use the new camera. A track that releases its value returns to the next contributing track or the base selector. Moving the cut changes the selected view without retiming the scene's artwork or the cameras' own tracks. Track evaluation

If m is the resolved viewport center, c is the sampled camera center, z is its zoom, and R is the clockwise y-down rotation defined below, a point p in scene coordinates is shown at m + z × R(−roll) × (p − c). At +90 degrees of camera roll, a point right of the camera center appears above viewport center. Apply this map after local drawable transforms. The viewport clips the resulting artwork. An object beyond the untransformed viewport may come into view. The scene background fills the fixed viewport beneath the transformed artwork. Audio and scene time follow their existing rules. Canvas and clock

A referenced scene resolves its own viewport and camera at its mapped source time. Its placement transforms and masks that projected picture in the enclosing scene, which may have a camera of its own. Groups and inline sequences share the enclosing scene's view. This camera model covers 2D framing, pan, zoom and roll. Perspective and depth use the projection proposed in the scene camera RFC and the separately ratified optical behavior. Scene camera RFC · Perspective camera optics · Source coordinates

Groups

A group is a drawable with zero or more ordered shape, group, or sequence children. It can occur directly under a scene, another group, a host shape, or an inline sequence. Later drawable children paint over earlier ones. A group also admits its own property animations, at most one source filter, one backdrop filter and one mask. A backdrop filter on a group requires that mask. Those children describe the group and occupy no drawing slots.

Grouping introduces local coordinates. By default, wrapping adjacent siblings in a group preserves their composite. A group's coordinate plane extends beyond its children's bounds. Its visible extent follows the content and any explicit mask. A group uses its enclosing composition's time, frame rate, and viewport. A key at frame 12 keeps the same frame address when its owner is put in a group on that timeline. A sequence placement introduces the mapping from parent time to source time. Sequence sampling

Local to parent

A boxed primitive establishes its contour in these local coordinates before its drawable applies the transform. Its registration defaults to its center on each axis. The drawable owns the rotation pivot in local units. Boxed geometry

The following attributes apply to shape, group, and sequence. Each is an independently keyable finite scalar. Missing attributes take their defaults.

AttributesDefaultMeaning
translate-x, translate-y0 eachMove the result along the parent's x and y axes, in parent units.
pivot-x, pivot-y0 eachCenter for scaling, skew and rotation, in the owner's local units.
scale-x, scale-y1 eachDimensionless factors along the owner's local axes. A negative factor reflects its axis.
skew-x0Horizontal shear angle in degrees, strictly between −90 and 90.
rotate0Angle in degrees, positive clockwise in the default y-down coordinate system.
opacity1Multiplier in [0, 1] on the completed visual result.

A locator places this local map at the sampled point of the nearest host. With orient="auto" the host tangent turns the entire map, including its translation. Attached drawable placement

For an ordinary local transform with local point v, pivot p, translation d, diagonal scale S, horizontal shear K, and rotation R, the point in the parent is d + p + R × K × S × (v − p). For angle θ, K maps (x, y) to (x + tan(θ) × y, y), with θ converted from degrees. Apply scale, then shear, then rotation about the local pivot. Omitted skew is the identity. For example, with pivot (2, 3), scale (2, 3), skew 45°, rotation 90° and translation (10, 20), local (3, 4) maps to parent (9, 28). At +90 degrees, R maps (1, 0) to (0, 1). Apply the child's map first, then each ancestor's map out to the scene. A zero on either scale axis collapses the visual result to zero area and contributes transparent pixels. Angle keys interpolate as ordinary numbers: a linear segment from 350 to 370 passes through 360. An edit to geometry, a mask, or a group's child list preserves the authored pivot coordinates.

For example, with pivot (4, 6), scale (2, 3), rotation 90, and translation (10, 20), the local pivot lands at (14, 26). A local point (5, 6) lands at (14, 28). If the parent then translates by (3, −2), the latter point lands at (17, 26) in the grandparent's coordinates. Stroke outlines, paint and coverage move with their owners, including under nonuniform scaling.

A rotated child under a nonuniformly scaled parent can have nonperpendicular axes in the scene. When ungrouping, a single local shear lets a writer keep the child's geometry and all four corners for any invertible 2D affine pose. Rotation and signed scale can give several equivalent decompositions. Preserve the existing authored components when the operation permits it. The zero-scale rule also permits collapsed artwork. Some singular matrices cannot be expressed on one drawable with a finite shear.

Compositing and coverage

The blend-mode of a drawable selects how it paints into its parent at its position in document order. Sample a mode change as a held enumerated property on the owner's clock.

OwnerDefaultAccepted modes
Shapenormalnormal, multiply, screen, pass-through
Grouppass-throughnormal, multiply, screen, pass-through
Sequencenormalnormal, multiply, screen
Paintnormalnormal, multiply, screen

Let D be the premultiplied encoded-sRGB destination before the drawable. Its own backdrop filter, when present, produces A by the backdrop blur rule. Otherwise A = D. Apply the owner's transform to locate all samples. Resolve the parent's earlier pixels only as far as the nearest enclosing paint scope.

  • With normal, multiply or screen, first assemble the contents on transparent black in local coordinates. Run the owner's source filter on that image. Blend the resulting source onto A using the selected mode to produce C. For straight encoded-sRGB channels s and d with alphas u and v, the premultiplied output channel is u(1−v)s + v(1−u)d + uv B(s,d). Output alpha is u + v − uv. B is s for normal, sd for multiply and s+d−sd for screen. Transparent pixels contribute zero premultiplied color.
  • With pass-through, begin with A. Paint the group's children, or the shape's attachments and appearance, in their ordinary order into that destination to obtain C. Each fill or stroke keeps its own paint stack. Its bottom paint's mode places the assembled stack into this destination. Paint stacks
  • A nonempty source filter on a pass-through owner establishes an isolated source for the entire lifetime of the declaration. Assemble the contents on transparency, filter them, then use normal source-over onto A. This structural boundary applies at every sampled sigma, including zero. An absent or empty filter preserves pass-through. Inserting the first operation can therefore change a child's Multiply result before any blur is visible. Animating that operation through zero preserves the child's blend destination. This lets artists filter the group as a unit while keeping earlier artwork sharp. Animated filter case
  • For every mode, return mix(D, C, w) on all four premultiplied encoded channels. w is the owner's mask coverage times opacity, with each defaulting to one. The parent backdrop therefore contributes once. Fractional opacity and masks preserve the child's chosen blend destination. A visual mask source starts on transparency. Referenced scenes retain their own initial background and inline sequences start on transparency.

Two overlapping opaque children in a group at opacity 0.5 yield alpha 0.5 throughout their union on a transparent destination. At a point admitted at half coverage by an alpha mask on that group, the resulting alpha is 0.25, including in the overlap. Moving the group moves both children and the mask. Moving one child leaves the group's mask in place. Mask sources

To mask several drawables together, place them in a group and attach the mask directly to that group. Moving a drawable across the mask declaration within the group keeps it masked. Moving it outside the group removes that group's coverage from it. Reordering drawables can still change which one is visible in an overlap. Two independently masked drawables each own their source shape in Level 1.

Spatial attributes and masks act on the visual contribution. Sound from children passes through the group at the same time and amplitude. A placement's gain scales its audio mix. Setting visual opacity to zero or moving an object outside the viewport preserves its audible contribution.

Footage behind a stationary window

This example assumes a square-pixel 1920 × 1080 movie with at least 13 seconds available. The mask's rectangle is local to the group. The movie plays behind it, and the horizontal pan belongs to that placement.

<scene width="640" height="360" frame-rate="24">
  <group translate-x="64" translate-y="36">
    <sequence href="./take.mp4" begin="0s" dur="3s" source-start="10s"
              scale-x="0.4" scale-y="0.4" translate-x="-96" translate-y="-72">
      <animate attributeName="translate-x" fill="freeze">
        <key frame="0" value="-96" ease="linear"/>
        <key frame="48" value="-120"/>
      </animate>
    </sequence>
    <mask type="geometry">
      <shape><rect width="512" height="288" anchor-u="0" anchor-v="0"/></shape>
    </mask>
  </group>
</scene>

At frame 0 the 512 × 288 window shows a 1280 × 720 source region starting at (240, 180). At frame 48 its source origin is (300, 180). In both cases the window starts at scene point (64, 36). Changing the mask width to 480 keeps the source origin and narrows the visible source region to 1200 units. Moving the group shifts the entire framed picture. A second shot placed later in the same group uses the same window with its own source in-point and pan. No fit to the new bounds occurs on resize.

An ordinary still can use image paint on a rectangular shape. To position the still at native size inside the same window, use a rectangle matching the image's dimensions, then transform its shape. The image-paint fitting rule continues to apply inside the painted rectangle. Image paint

Design evidence

SVG groups and nested coordinate transformations establish the group as a spatial scope. CSS Transforms defines applying a transform relative to an origin by translating to the origin and translating back. Explicit components on the owner give an editor a separate patch target for a pan, scale axis, angle, or pivot coordinate. SVG coordinate systems · CSS transform rendering model

Lottie specifies group-scoped transforms and opacity on the composited group. W3C Compositing defines an isolated group's initial transparent backdrop, and CSS Masking applies coverage to a composed image. These precedents give a single opacity and mask rule for an individual drawable or several children assembled into one result. Lottie shape groups · Isolated groups · CSS Masking

On this page