how to use it
4 stepsFour things to know, each as short as it can be. The code is the code: copy it and it works.
1 make a scene
In the leaf editor, select two or more shapes, press morph and then live, and set it going: keys, paths, motions, colours, clips, whatever it needs. Then the morph bar's tvfs button writes the file. Or start from any tile on the animated page: open in draw, change it, press tvfs.
What is on the page is what is written: the live morphs as their keys and their own settings, every other shape as it stands, in the drawing's order, with the bar's ease, hold, trail, gravity and wind and the loop's length.
2 put it on a page
Two scripts and a canvas. The canvas names its scene in data-tvfs and plays as soon as the
page has loaded; give it a size with CSS, and the player draws at that size, times the screen's pixel
ratio.
The files can live anywhere a page can fetch from: next to it, or here (GitHub Pages lets
any page fetch them). data-background paints the canvas first; without it the page shows
through.
3 drive it from a script
TVFPlayer.play takes a canvas and a scene (its address, or the object) and hands back the
controller:
For a loop of your own, load the scene once and draw it into any 2D
context at any time; poses gives each morph's outline at a time as numbers, the leaves
{x, y} or the corners {x, y, r, c}, for anything else you want to do with them.
4 what is in the file
One JSON object, written for reading back, not for frames:
Leaves are float32 in base64, two rows a shape; exact shapes keep their corners, roundings,
smooth corners, curve handles and holes. A morph's own is the editor's own record of its
settings (clock, path, motion, colour, clip, parent, facing), read back by the editor's own function. Not in
it: anything the editor shows only while editing (guides, handles, numbers).
your own
drop a .tvfs or a LottieOpen a .tvfs or drop one on this panel, and it plays here at the size of the
panel. A Lottie file (Bodymovin's .json) is turned into a scene first, here, by
player/lottie.js, and what it could not read is named under the panel. Scrub it with the slider. Nothing is sent anywhere: the file is read in this tab. The same is on its own
page, player/player.html, which also takes ?src=.
no scene yet: try one of the examples below, each has a download button