LAST
Lottie Abstract Syntax Tree.
last is a specification for representing Lottie JSON in a syntax tree. It implements unist.
Contents
- Introduction
- Install
- Nodes
- Glossary
- List of utilities
- References
- Security
- Related
- Contribute
- Acknowledgments
Introduction
This document defines a format for representing lottie as an abstract syntax tree. Development of last started in 2022.
Install
Where this specification fits
last extends unist, a format for syntax trees, to benefit from its ecosystem of utilities.
last relates to JavaScript in that it has a rich ecosystem of utilities for working with compliant syntax trees in JavaScript. However, last is not limited to JavaScript and can be used in other programming languages.
last relates to the unified and relottie projects in that last syntax trees are used throughout their ecosystems.
Nodes
Parent
Parent (UnistParent) represents an abstract interface in last, containing other nodes (said to be children). In addition, has title
prop which contains Lottie qualified name that can be found in titles.ts (that based on lottie-json-schema)
Literal
Literal (UnistLiteral) represents an abstract interface in last containing a value.
Root
Root (Parent) represents a Lottie JSON.
Root can be used as the root of a tree, never as a child.
Root also has hasExpressions
prop that tells whether the Lottie animation contains JS expressions. It is important to identify it early because of the security concerns.
Primitive
Primitive (Literal) represents a JSON property’s value
KeyNode
KeyNode (Literal) represents a JSON property key.
Member
Member (Parent) represents the main interface for nodes that have a JSON property key that could be (KeyNode) or a string value.
ObjectNode
ObjectNode (Parent) represents a JSON object value.
ArrayNode
ArrayNode (Parent) represents a JSON array value.
Attribute
Attribute (Member) represents a Member node which value is (Primitive).
Element
Element (Member) represents a Member node which value is (ObjectNode).
Collection
Collection (Member) represents a Member node which value is (ArrayNode).
Glossary
See the unist glossary.
List of utilities
See the unist list of utilities for more utilities.
last-builder
— build last structures with composable functions
References
- unist: Universal Syntax Tree. T. Wormer; et al.
- lottie-web: Lottie Web Player. H. Torrisi; et al.
- lottie-docs: A human’s guide to the Lottie format. M. Basaglia; et al.
- Lottie Animation Format Documentation
Security
As last properties can have expressions, and improper use of last can open you up to cross-site scripting cross-site scripting (XSS). Carefully assess each plugin and the risks involved in using them.
Related
Contribute
By interacting with this repository, organization, or community you agree to abide by its terms.