top of page

TweenPlayer

One animation system. Two ways to create.

TWEENPLAYER / ILLUSTRATIVE MOTION STUDY

Define the endpoints. Shape the easing. Control playback.
A conceptual motion study, not a product recording.

A unified animation system for Lens Studio that connects a visual Inspector workflow with a fluent TypeScript API—built on native animation playback.

Developer tools

Interaction design

Animation systems

Platform:

Lens Studio

Focus:

Visual authoring + TypeScript

The challenge

Deliverables:

Reusable tool + example packages

01

Animation tools shouldn’t interrupt the creative process.

Lens Studio offered multiple paths to animation: TweenManager, LSTween, and Animation Player. Each served a different workflow, leaving creators to connect visual configuration, scripting, and playback themselves.

FIRST, WHAT IS A TWEEN?

Animation between two values.

A tween fills in every value between a start and an end over a set time, usually shaped by an easing curve. The name comes from in-between. You define the start, end, and duration; the system calculates every step.

moveToLocal · 1000 ms · Cubic.InOut

(0, 0, 0)

(0, 10, 0)

Three tools, three workflows

TweenManager

LSTween

Animation Player

TweenPlayer

STRENGTH

Extensive Inspector workflow, approachable without code

Convenient scripting APIs for Specs development

Native component; computation happens in the engine

Inspector and TypeScript in one system

BACKEND

tween.js

tween.js

Native

Native AnimationPlayer clips

TRADE-OFF

Limited scripting

Code-only authoring

Limited authoring tools

—

Creators were asking for help. Questions like “How do you create an animation?” kept surfacing on Reddit and Discord. The capabilities existed—they just didn’t feel like one coherent authoring experience.

A fragmented workflow

Visual authoring and convenient scripting existed in separate tools. Native playback offered engine-level capabilities, but authoring remained difficult to navigate.

One shared foundation

Give designers and programmers two ways into the same system, with consistent animation behavior and native curve sampling.

Three goals

1

One system, two surfaces

Serve both Inspector authoring and scripting from a single model, both compiling to the same AnimSpec.

2

Consolidate the features

Bring the most useful tweening features together, then extend them.

3

No JS interpolation per frame

Stop recalculating easing curves in JavaScript for every tween, every frame.

The system

02

Visual when you want it.
Programmable when you need it.

TweenPlayer combines an Inspector component, a scripting API, and a core engine. Both authoring paths feed the same playback foundation.

Inspector component

Configure animations visually, without code. Adjust properties and custom easing curves.

TypeScript API

Compose animations through a fluent API, callbacks, and named playback controls.

Core animation engine

Lifecycle · Tween registry · Endpoint conversion · Playback

Native AnimationPlayer clips

Simplified architecture, adapted from the project presentation.

Native curve sampling

AnimationPlayer samples eased progress natively. A TypeScript callback applies the resulting value to the target; the scheduler coordinates updates and lifecycle.

Predictable control

Start, pause, resume, and stop named animations. Configure looping, speed, and completion callbacks.

Composable motion

Build coordinated behavior through chaining, parallel playback, and staggered animation.

What changes in a tween’s lifetime

BEFORE · TWEEN.JS

1

JavaScript keeps every tween’s state.

2

JavaScript evaluates the easing formula.

3

TWEEN.update() runs every frame, for every tween.

AFTER · TWEENPLAYER

1

An AnimationCurve is built once, when the tween is created.

2

It’s placed on an AnimationPlayer property track and played as a clip.

3

The engine samples the curve natively; TypeScript applies the value to the target.

WHERE THE COST LANDS, OVER A TWEEN’S LIFE

Per-frame

a compute spike every frame
(easing + lerp + set)

Pre-created

one spike at creation, then flat

create → engine evaluates the curve →

The same tween, two backends

TWEEN.JS

new TWEEN.Tween(position)
  .to({ x: 10 }, 600)
  .easing(TWEEN.Easing.Cubic.InOut)
  .start();

script.createEvent("UpdateEvent").bind(() => {
  TWEEN.update(getTime() * 1000);
});

JavaScript calculates and updates every tween, each frame.

ANIMATIONPLAYER

const curve = AnimationCurve.createEasingCurve(...);

layer.setCustomProperty(
  "progress",
  AnimationPropertyTrack.createFloatFromCurves(curve),
  (_, value) => apply(value as number)
);

const clip = AnimationClip.createFromAnimation(name, asset);
player.addClip(clip);
player.playClipAt(name, 0);

Lens Studio’s native engine samples the curve.

Hybrid by design. AnimationPlayer is the timing foundation: it plays native clips efficiently and returns reliable 0→1 progress, easing included. On its own it isn’t a full tween system, so a TypeScript layer writes values to transforms, materials, screen UI, script values, and VFX parameters—and handles delays, loops, callbacks, chaining, and named control. The curve sampling is native; the complete tween is not, and that distinction shapes both the architecture and its performance.

TweenPlayer

Inspector component + clips

Anim / AnimHandle scripting API

Easing, values, named control

uses ↓

AnimationPlayer
native backend

Clock + playback lifecycle

Pooled clips (0→1 time ramp)

Inside the package

TweenPlayer.lspkg

unified animation package

CORE

AnimationSystem

Engine, named registry, and AnimController: active animations and playback control.

uses ↓

NativeClipRunner

Builds the curves and AnimationPlayer clips.

uses ↓

Types.ts

AnimSpec, value writers, warnings.

Easing.ts

Easing curves + families.

API

Anim.ts

Scripting factories for typed animations.

returns ↓

AnimHandle.ts

Fluent builder → .start(), which builds into AnimationSystem.

COMPONENTS

TweenPlayer.ts

The Inspector component, holding a list of TweenAnimationClips.

calls Anim.ts + AnimHandle.ts

The Inspector doesn’t have its own runtime. It goes through the same scripting API a developer would call.

↓

RotationInterpolationType.ts

Rotation interpolation modes.

Not two animation systems—two interfaces into the same core. Both surfaces compile to the same AnimSpec, so an animation built in the Inspector can still be controlled from a script by name.

Inspector: before and after

BEFORE · RAW ANIMATIONPLAYER CLIP

Playback-level settings. Powerful, but it doesn’t describe a movement from one value to another.

Clip Range Type

Animation Asset

Weight

Playback Speed

Begin

End

Offset

Reversed

Blend Mode

Scale Mode

Playback Mode

AFTER · TWEENPLAYER COMPONENT

Tween-level settings. Choose what to animate and where it ends, then shape timing and easing—including custom easing curves—without writing code.

TweenAnimationClip list

Transform · material · screen · custom

Custom easing curves

Named for script control

Authoring motion in the Inspector.

FROM API CALL TO NATIVE PLAYBACK

A shared scheduler, backed by native clips.

Calling .start() turns an AnimHandle into a complete AnimSpec. The shared clock processes the delay, then captures live start values when movement actually begins.

The system creates or reuses an easing curve from its cache and acquires a clip slot from an AnimationPlayer bank. Native playback samples eased progress; a TypeScript closure applies that value to the target.

At completion, the scheduler stamps the exact final value and releases the clip slot. A once-per-frame LateUpdate coordinates the registry and tween lifecycle.

moveToLocal  Creates a typed position tween; 600 is the duration in ms.

.delay  Schedules the tween on the shared clock.

.pingPongOnce  Moves forward, then returns.

In practice

FLUENT TYPESCRIPT API

Anim.moveToLocal(
  target.getTransform(),
  new vec3(0, 10, 0),
  600
)
  .easing(Easing.Cubic.InOut)
  .delay(150)
  .name("raiseCard")
  .pingPongOnce()
  .onComplete(() => print("Done"))
  .start();

// Control a registered animation.
global.tweenPlayer.pause("raiseCard");
global.tweenPlayer.resume("raiseCard");

.easing  Selects the acceleration and deceleration curve.

.name  Registers it for global playback control.

.start  Compiles the configuration and submits it to the runtime.

03

A small system.
A broad animation vocabulary.

The examples package makes the system tangible through reusable demonstrations, from basic object movement to coordinated interface behavior.

01

Transforms

Position, rotation, and scale—the most common object-animation needs—with configurable movement modes and easing.

02

Materials

Color, opacity, float properties such as roughness, and vector properties, with the same playback controls used for object motion.

03

Screen transforms

UI-oriented position, rotation, and scale. Easing choices produce elastic, wiggly, or stretchy motion that stays visually editable.

04

Custom values

Extends the same timing beyond built-in properties—a counter, a stepped value, a glow—targeting script values, material parameters, and exposed VFX parameters.

05

Orchestration

The same named animations run as a chain, in parallel, or staggered—so composition changes without rewriting each target animation.

06

Scripting

Code-driven behavior on the same system. Inspector and script aren’t two modes to choose between—they’re two entry points combined in one experience.

Loops

Ping-pong

Delays

Easing families

Chaining

Parallel + stagger

Transform, material + custom targets

Feature parity with TweenManager and LSTween, in one system.

Extending it

04

A foundation for AI-assisted authoring.

CLAD is a suite of agents and skills that lets AI work in Lens Studio as a co-developer. The project explores an animation skill for it: a developer describes the motion, the skill turns it into TweenPlayer scripts, and Lens Studio plays the result on the same foundation.

ANIMATION SKILL FOR CLAD

Prompt

→

Animation skill

→

TweenPlayer scripts

→

Lens animation

Why not author every animation with AI?

Reliability

Tweens are declarations of movement—“move here, ease out, ping-pong”—not dense, baked keyframes.

Control

Creators still want direct control: editing easing curves in the interface.

Flexibility

Motion has to react to runtime state; a “to” animation can’t be prebaked.

Orchestration

Chain, parallel, stagger, loop, pause, resume, and start by name from other systems.

The strongest workflow pairs AI assistance with an editable animation system.

The animation skill in action.

Delivery

05

Built to be reused.

The work brings visual authoring and scripting together in a unified animation system, delivered as reusable tool and examples packages with supporting documentation.

TweenPlayer.lspkg

The lightweight runtime tool, installable on its own.

Examples package · .lspkg

Six guided sample scenes to add when you want a hands-on reference.

Documentation

A developer reference on the Snap for Developers site, alongside the examples.

01 Transforms

02 Material

03 Screen Transform

04 Custom Value

05 Control

06 Scripting

Goal check

✓

One system

Visual and scripted authoring share one model and one registry.

✓

One feature set

Loops, easing, chaining, callbacks, and named controls in one place.

✓

Native sampling

AnimationPlayer samples the curves instead of per-tween easing math in JS.

For creators

A visual workflow for configuring and refining motion, with concrete examples that show what the system can do.

For developers

A fluent TypeScript API and shared native playback foundation for animation that responds to runtime state.

Project by Hsin Wang · Specs Lenses Platform. With mentorship from Olha Rykhliuk and support from Jonathan Solichin and the wider team, as credited in the presentation.

bottom of page