Ask the assistant
0/400
Your question is processed by an AI service and kept to improve answers. Do not enter personal data.

    Motion: scene and time

    *Scene is a film with a clock. The scene publishes the current time ( time:@t ), and everything under it is a function of that time: the frame at t = 2.4 is always the same, seeking costs one assignment, and an export can draw frames in any order. Around the scene is the vocabulary that such time is written with: values as key frames ( *Track / *Keyframe ), pieces of the film in time ( *Layer / *Delay ), named moments ( *Marker ) and a fixed-shape canvas without a clock ( *Artboard ).

    This is the second half of animation in REEEL. *Animated reacts : a value changed — a tween starts, and "the frame at 00:42" exists only after all the frames before it. A scene, the other way round, takes time as input .

    Type: multi-child (all elements of the family except *Marker and *Keyframe — those are data, leaf )

    *Scene duration:6s fps:30 time:@t
      *Track value:@y curve:easeOutCubic
        *Keyframe at:0 v:1200
        *Keyframe at:0.8 v:540
        *Transform translateY:$y
          *Text "REEEL" color:0xFFFFFFFF

    Inside a scene, the drawing is done by elements of the * family ( Render primitives : *Rect , *Path , *Text , *Sprite …), but a scene is not only primitives: a regular Text or a whole macro of regular markup can also stand inside and read {t} . 3D in a film is .Scene seek:{t} ( 3D scenes ); redrawing a film with a video model — AI video ; the film's sound — *Sound (not to be confused with the page's `Sound` ).

    Element What it does
    *Scene the clock and the frame of the film
    *Marker a named moment you can play to
    *Layer how long a piece of the film lives; inside it time starts from zero
    *Delay shifts the clock of a subtree without hiding it
    *Track a value over time — one row of the timeline
    *Keyframe one key of a track
    *Animated a tween on a value change — without a clock
    *Opacity / *Transform / *Clip effects over a drawn subtree
    *Artboard a fixed-shape canvas, without a clock

    *Scene

    The root of a film: a clock, and everything under it is a function of it. On its own the scene plays ( autoplay , and loop if you want). Give it seek: — and it stops running by itself and shows exactly the named moment: that is how the timeline playhead, the export loop and the scroll position drive it.

    Parameter Type Default Description
    duration duration 5s How long the scene lasts
    time @ variable — The current time in seconds is written here
    frame @ variable — The current frame number is written here (by fps )
    fps number 30 Frames per second — for frame:
    autoplay bool true Play by itself from the first frame; has no effect with seek:
    loop bool false Start over at the end instead of holding the last frame
    seek number (seconds) — Drive the clock from outside; the scene then never runs by itself
    controller string — A command ( forward , reverse , stop , pause , reset , fromStartToEnd , fromEndToStart ) or the id of a marker to play to. A scene with a controller does not play by itself — it waits for a command
    size [w,h] — The SHAPE of the frame: the scene takes the space it is given, and the frame is fitted into it, centered. Pixels are the export's business
    viewBox [w,h] — What the coordinates of everything under the scene are measured in; without it — fractions of the box
    units string — px — measure in real pixels instead of fractions; inherited, like viewBox

    t is seconds from the start, a number. It is read like any variable: {t * 120} , {sin(t * 3)} , {clamp((t - 2) / 0.5, 0, 1)} .

    *Scene duration:6s fps:24 time:@t frame:@n
      *Transform translateY:{0.3 - 0.3 * clamp(t / 0.8, 0, 1)}
        *Text "REEEL" color:0xFFFFFFFF

    The frame: size: and viewBox:

    size: fixes the shape, not the pixels: [1920,1080] and [1280,720] behave the same on screen. Without size: , 0.5 is half of the box the scene ended up in (a wide preview panel, a narrow phone); with it — half of the film everywhere.

    size: is NOT coordinates. To write in frame pixels, say so once, with viewBox: :

    *Scene duration:6s fps:30 size:[1920,1080] viewBox:[1920,1080] time:@t
      *Colored color:0xFF0B0B10
      *Rect x:480 y:400 w:960 h:280 radius:24 fill:0xFF6C5CE7

    One coordinate system per surface, and *Text size: is in it too: with viewBox:[1080,1920] , x , y and size are frame pixels; without it everything is fractions, and size:0.08 is 8 % of the frame HEIGHT. Fractions for x / y together with a size: "in pixels" draw nothing ( text_size_in_fractions ).

    In a motion project the frame is set by the project ( frameSize ), and size: on *Scene overrides it — in such a project size: is not put on the scene.

    Scene driven by scrolling: seek:

    ScrollData progress:@p
      $Intro seek:{p * 6}

    Scrolling back plays the animation backwards without a single line of code: the frame is a function of p , and the way back is the way there, read in the other direction.

    Scene driven by an event: controller:

    InView visible:@seen
      *Scene duration:600ms time:@t controller:{seen ? "forward" : "reverse"}
        *Opacity value:{clamp(t / 0.6, 0, 1)}
          *Rect radius:16 fill:0xFF6C5CE7

    forward and reverse continue from wherever the clock is: an icon that left the screen half shown fades out from the half. A number in controller: is NOT a command (for *Animated a number is a target in [from, to] ; a scene would read it as seconds); to jump to a moment there is seek: , and to play up to a point — *Marker .

    Read a step, not the clock

    The scene writes the time WITH a notification — otherwise a regular Text inside it would freeze while the drawing moves. Only subscribers pay for it, so give a regular element that does not need every value a step:

    *Scene duration:8s time:@t
      Row
        Text {floor(t * 2) % 2 == 0 ? "|" : " "}
        Text $"{floor(t)}s"

    {floor(t * 2)} rebuilds the label twice a second, {t} — thirty times.

    *Marker

    A named moment on the scene's timeline. It is data, not a layer: it draws nothing and takes no space — the scene reads markers from its children. It is needed so that a command can say WHERE to play without a number: a number rots (the animation was moved — and every caller that hard-coded a second points at the wrong frame, silently), a name survives the edit. The timeline shows a marker as a flag above its moment.

    Parameter Type Description
    at number (seconds) The moment on the scene's clock
    id string The name that the scene's controller: can name
    State @open:false
      *Scene duration:2s time:@t controller:{open ? "opened" : "closed"}
        *Marker at:0   id:"closed"
        *Marker at:0.6 id:"opened"
        *Track value:@h
          *Keyframe at:0   v:0
          *Keyframe at:0.6 v:220
          *Rect h:{h / 220} fill:0xFF6C5CE7

    open → the scene plays to opened and stops exactly on it; back — it plays to closed , backwards, from wherever it got to.

    *Layer

    A layer of the scene: how long it lives and its own zero. Inside its interval it draws, outside it does not. Inside a layer the clock is reset at its start: at 2.4 s of the film a layer with in:2s is at 0.4 s. So a piece written from ITS OWN zero can be placed anywhere on the timeline.

    Parameter Type Default Description
    in seconds — When the layer starts, on the enclosing clock ( in:1s and in:1 are the same)
    out seconds to the end When it ends; not given — to the end of the enclosing clock. The end is not included: neighbors with out:4s and in:4s are not both drawn at the joint
    z number 0 Drawing order in the nearest *Stack , *Scene , *Artboard or group of several children: higher — closer and drawn later; on a *Layer it is the key of the whole branch. Outside in: / out: the layer gives no key
    // a beat is a macro; in a project it lives in reeel/components/ and comes in by import
    @Intro
      *Track value:@o
        *Keyframe at:0   v:0
        *Keyframe at:0.6 v:1
        *Opacity value:$o
          *Text "REEEL" color:0xFFFFFFFF
    
    *Scene duration:12s time:@t
      *Layer in:0 out:3s
        $Intro
      *Layer in:5s out:8s
        $Intro

    One macro, twice, at two different moments — and inside $Intro nothing is known about either of them. That is why a reusable animation does NOT take a "when to play" parameter: when is the caller's business, *Layer in: . A layer inside a layer measures by the local time of the outer one.

    Sound and video are placed with the same words: *Layer in:/out: says WHEN they are heard and seen in the scene, and trim: on *Footage / *Sound — which piece of the FILE.

    *Delay

    Shifts the clock of a subtree without hiding it. The cascade every motion designer reaches for: the same animation on N things, each one beat later than the previous. Inside *Repeat the shift reads the loop index — one line shifts all of them.

    Parameter Type Description
    by seconds How much to shift the clock; negative — a shift EARLIER, like delay on Animated
    *Scene duration:4s time:@t
      *Repeat count:5
        @Macros index:0
          *Delay by:{index * 0.08}
            *Track value:@o
              *Keyframe at:0   v:0
              *Keyframe at:0.4 v:1
              *Opacity value:$o
                *Rect x:{index / 5} w:0.18 fill:0xFF6C5CE7

    @Macros index:0 here is the template of ONE *Repeat item, not a macro declaration.

    *Layer or *Delay . A layer cuts off : outside its interval nothing of it is drawn. A delay only shifts : before its zero the subtree is drawn, holding what its first key says. A layer is "this exists from here to there", a delay is "this happens one beat later than that".

    *Track

    Publishes a value that changes over time, written with keys rather than arithmetic. One value can be written as an expression of t ; twenty can no longer, and the timeline cannot grab an expression: a diamond dragged with the mouse has to exist in the source. Between keys the value is interpolated; before the first key the first value is held, after the last — the last.

    Parameter Type Default Description
    value @ variable — The interpolated value is written here
    curve curve name linear Default easing for every segment
    speed number — Pace along the path, in value units per second; key moments are then taken from the path length
    distance @ variable — The distance traveled is written here (along the ground, jumps included)
    heading @ variable — 1 (moving right) or -1 (left) is written here; standing still — unchanged
    air @ variable — The height of the current jump is written here
    z number 0 Drawing order (as on *Layer ): on a *Track it is the key of the whole branch

    As with *Scene (and unlike *Animated ), the value is published WITH a notification — a regular element inside the scene reads it just like a primitive does.

    The drawing goes INSIDE the track

    A variable declared on an element is visible only to its subtree. So what the track animates is written as its child. A neighbor at the same indentation reads $y as the text "y", and the analyzer reports variable_out_of_scope .

    // BAD — the transform stands NEXT TO the track and does not see y
    *Scene duration:4s time:@t
      *Track value:@y
        *Keyframe at:0 v:0.2
      *Transform translateY:$y
        *Rect fill:0xFF6C5CE7
    // GOOD — the drawing is a child of the track
    *Scene duration:4s time:@t
      *Track value:@y
        *Keyframe at:0 v:0.2
        *Transform translateY:$y
          *Rect fill:0xFF6C5CE7

    Hence the rule: a key is never the last line of a track — the drawing comes after the keys. Several values — several tracks nested in each other:

    *Scene duration:4s time:@t
      *Track value:@y
        *Keyframe at:0   v:0.2
        *Keyframe at:0.6 v:0
        *Track value:@o
          *Keyframe at:0   v:0
          *Keyframe at:0.6 v:1
          *Opacity value:$o
            *Transform translateY:$y
              *Rect radius:16 fill:0xFF6C5CE7

    Curves

    A track's curve: is the default for every segment; a key's curve: is for the segment COMING INTO that key. Two keys without a curve are a straight line , on purpose (on Animated an unnamed curve is easeOut ). Curve names are Flutter's: easeOutCubic , easeInOutSine , bounceOut , elasticOut ; easeOutBounce is not a name, and an unknown name goes as a straight line — silently in the picture; the analyzer reports unknown_curve .

    *Scene duration:4s time:@t
      *Track value:@x curve:linear
        *Keyframe at:0 v:0
        *Keyframe at:1 v:100 curve:easeOutBack
        *Keyframe at:2 v:120
        *Rect x:{x / 120} w:0.1 fill:0xFF6C5CE7

    A path at a pace: speed:

    A character walking across a city is not a table of moments but a path and a pace. With speed: keys are written WITHOUT at: : each segment takes its length divided by the speed. On a key, pause: holds it, arc: lifts the segment coming into it into a jump. Three outputs make walking walking: distance:@d turns the frames of the step cycle by the distance traveled — the feet do not slide; heading:@h turns the sprite around; air:@a is the current jump height.

    *Scene duration:8s time:@t size:[1080,1920] viewBox:[1080,1920]
      *Track value:@pos speed:180 distance:@d heading:@dir air:@up
        *Keyframe v:[120, 1600]
        *Keyframe v:[520, 1420] pause:1.5
        *Keyframe v:[700, 1300] arc:140
        *Sprite src:"data/images/hero_walk.png" grid:[8,1] frame:{floor(d / 48) % 8} flipX:{dir < 0} x:{pos[0] - 48} y:{pos[1] - 96} w:96 h:96
    • at: on a path key is an error ( track_speed_at ): the moment comes from the path. To start walking later, wrap the track in *Layer in: .
    • pause: on a track without speed: does nothing ( pause_without_speed ).
    • distance , heading and air are published without speed: too — by the keys' own at: .
    • A walking character is built from a rig, not from a single image: $<Name>Walk inside the same kind of *Track speed: .

    More about tracks

    • Keys out of order are sorted by time before drawing; the analyzer tells the author about it ( keys_unordered ).
    • A track is a function of the clock: outside a *Scene it has nothing to depend on, and it stands still.

    *Keyframe

    One moment of a track: a value and when it holds. It draws nothing — the track reads keys from its children as data. It is an element and not a list literal so that the timeline can drag ONE of them: a diamond has its own range in the source, and the analyzer, unhappy with a key, has a line to point at.

    Parameter Type Description
    at seconds When the key holds, on the enclosing clock. Not written in a track with speed:
    v number or list of numbers The value at that moment
    curve curve name Easing of the segment ENDING at this key; by default — the track's curve
    pause seconds How long to stand on the key before moving on (a track with speed: )
    arc number Jump height on the segment coming into this key, in value units (screen y upwards, at the middle of the segment)

    A key holds a number or a list of numbers — the same forms *Animated interpolates, so a whole series can be keyed at once. Lists of different lengths are resampled.

    *Scene duration:4s time:@t
      *Track value:@bars
        *Keyframe at:0 v:[10, 40, 25]
        *Keyframe at:1 v:[35, 15, 50]
        *Repeat count:{length(bars)}
          @Macros index:0
            *Rect x:{index/3} w:0.28 y:{1 - bars[index]/60} h:{bars[index]/60} fill:0xFF6C5CE7

    Drawing effects

    *Transform (translate, rotate, scale, pivot: ), *Opacity , *Clip and *Animated (a tween on data change, without a timeline) are shared by the scene and regular 2D drawing; their parameters and examples are on the Render primitives page. Inside a *Scene their parameters read {t} and track variables, like any element.

    *Animated or *Scene . *Animated — when the animation is a reaction to data without a timeline: a chart flows when new values arrive. A scene — when there is an order ("first this, then that") or the motion needs to be seeked and exported.

    *Artboard

    A fixed-shape canvas — a drawing surface without a clock. *Scene is that plus time; taken separately, the same drawing can stand in a film, on a document page or in the editor without a timeline. The SHAPE is fixed: the artboard takes the space it is given, fits the canvas and centers it, so 0.5 is the middle of the CANVAS, wherever it is shown. Without size: it simply fills the box, and fractions are fractions of the box.

    Parameter Type Description
    size [w,h] Canvas shape; without it — fill the box
    viewBox [w,h] What the coordinates under the canvas mean; without it — fractions
    units string px — measure in real pixels instead of fractions
    *Artboard size:[1000,1000]
      *Colored color:0xFF0B0B10
      *Circle cx:0.5 cy:0.5 r:0.3 fill:0xFF6C5CE7

    It neither publishes nor reads a clock: nested in a *Scene , the drawing inside still animates — time comes from above unchanged. That is how a square panel is put into a wide film, and the drawing inside does not need to know about it:

    *Scene duration:4s time:@t size:[1920,1080]
      *Artboard size:[1000,1000]
        *Rect x:0 y:0 w:{clamp(t / 2, 0, 1)} h:1 fill:0xFF6C5CE7

    A primitive that has its own coordinates says so itself and wins:

    *Artboard viewBox:[100,100]
      *Rect x:10 y:10 w:80 h:80 fill:0xFF6C5CE7
      *Rect x:0 y:0 w:0.25 h:1 viewBox:[1,1] fill:0x33FFFFFF

    Examples

    A film made of beats

    The root scene holds the clock, layers, sound and subtitles; each beat is its own macro in reeel/components/ , placed with *Layer in: .

    // a beat is a macro; in a project it lives in reeel/components/ and comes in by import
    @Intro
      *Track value:@o
        *Keyframe at:0   v:0
        *Keyframe at:0.6 v:1
        *Opacity value:$o
          *Text "REEEL" color:0xFFFFFFFF
    
    *Scene duration:12s fps:30 size:[1080,1920] viewBox:[1080,1920] time:@t
      *Layer in:0 out:4s
        $Intro
      *Layer in:4s out:12s
        $Intro

    A value that a beat reads from an outer *Track is passed as a parameter ( $Planets x:$sunX ) and stays live.

    A pan across a video: *Track drives a parameter

    *Scene duration:8s fps:30 time:@t size:[1080,1920] viewBox:[1080,1920]
      *Layer in:0s out:8s
        *Track value:@pan curve:easeInOutCubic
          *Keyframe at:0 v:0.3
          *Keyframe at:3 v:0.3
          *Keyframe at:4.5 v:0.75
          *Footage src:"footage/interview.mp4" trim:[12s,20s] fit:cover focusX:$pan mute:true

    Depth: near in front of far

    On a street seen from above at an angle, document order goes wrong as soon as people start walking. Everything that stands on the ground gets z: — the y of its feet, read every frame; the background and flat things — no key (0, below everything). *Track , *Layer and effects pass the key of the first live element inside upwards.

    *Scene duration:8s fps:30 size:[1080,1920] viewBox:[1080,1920] time:@t
      *Sprite src:"data/images/street.png" x:0 y:0 w:1080 h:1920
      *Track value:@pos speed:120
        *Keyframe v:[400,1200]
        *Keyframe v:[900,1500]
        *Rect x:{pos[0] - 30} y:{pos[1] - 7} w:60 h:14 radius:7 fill:0x50000000
        *Sprite src:"data/images/hero.png" x:{pos[0] - 48} y:{pos[1] - 135} w:96 h:135 z:{pos[1]}

    Bad practices

    Two roots in one file

    // BAD — the data stands NEXT TO the scene: two roots, the preview shows a gallery, not a film
    JsonData src:"data/subtitles.jsonl" data:@subs
    *Scene duration:30s fps:30 time:@t
      *Captions cues:$subs

    Analyzer: scene_multiple_roots . The data wraps the scene:

    // GOOD
    JsonData src:"data/subtitles.jsonl" data:@subs
      *Scene id:ready duration:30s fps:30 time:@t
        *Captions cues:$subs

    A clock inside a clock

    One *Scene per film. A piece in time is *Layer in: ; a canvas of another shape is *Artboard .

    Video and Audio inside a scene

    They have their own clocks, unrelated to the film's clock: almost right in the preview, falling apart in the export (frames faster than real time and out of order). Analyzer: playback_clock_in_scene . A clip is *Footage , sound is *Sound .

    An image as Image instead of *Sprite

    Image is laid out in logical screen pixels and does not know about viewBox ( image_in_scene ). An image in a film is *Sprite x: y: w: h: .

    See also

    • Render primitives — *Rect , *Path , *Text , *Stack , *Repeat — what you draw with inside a scene
    • 3D scenes — .Scene in a film: seek:{t}
    • AI video — *AiShot , *AiReplace : redrawing a film with a video model
    • Sound — the page's sound (not the film's; the film's track is *Sound )
    • Animation — animation of Flutter widgets