All Projects → motiondeveloper → create-expression-lib

motiondeveloper / create-expression-lib

Licence: MIT license
🐱‍👤 CLI to create an After Effects expression library in TypeScript

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to create-expression-lib

DuAEF
Duduf After Effects Framework
Stars: ✭ 20 (-13.04%)
Mutual labels:  after-effects, expressions
AE-Slicer
Save PNG slices in AE. Support multiple slice zones in one comp.
Stars: ✭ 21 (-8.7%)
Mutual labels:  after-effects
React Lottie
Render After Effects animations on React based on lottie-web
Stars: ✭ 1,132 (+4821.74%)
Mutual labels:  after-effects
Duaef duik
Duduf After Effects Framework | Duik
Stars: ✭ 197 (+756.52%)
Mutual labels:  after-effects
Pixi After Effects
play AfterEffects animation by pixi.js
Stars: ✭ 90 (+291.3%)
Mutual labels:  after-effects
Flopsy
A cute little bunny animation that responds to text field interactions.
Stars: ✭ 242 (+952.17%)
Mutual labels:  after-effects
Nexrender
📹 Data-driven render automation for After Effects
Stars: ✭ 946 (+4013.04%)
Mutual labels:  after-effects
color-math
Expressions to manipulate colors.
Stars: ✭ 18 (-21.74%)
Mutual labels:  expressions
adobe-discord-rpc
Discord Rich Presence extension for your adobe apps!
Stars: ✭ 383 (+1565.22%)
Mutual labels:  after-effects
Ae Element
🎨 use bodymovin to render some interesting After Effects vector element
Stars: ✭ 180 (+682.61%)
Mutual labels:  after-effects
Sketch2ae
A Sketch plugin to export sketch file to Adobe After Effect
Stars: ✭ 170 (+639.13%)
Mutual labels:  after-effects
U.movin
Unity library for rendering After Effects shape animations
Stars: ✭ 122 (+430.43%)
Mutual labels:  after-effects
Unmockable
💉 ↪️ 🎁 Unmockable objects wrapping in .NET
Stars: ✭ 35 (+52.17%)
Mutual labels:  expressions
Css Sprite Exporter
A script can help generate css sprite animation from AE comps.
Stars: ✭ 80 (+247.83%)
Mutual labels:  after-effects
AEScript-Explode-Shape-Layer
Extract shapes from a shape layer to individual layers
Stars: ✭ 37 (+60.87%)
Mutual labels:  after-effects
Kinecttopin
(Eyebeam #1 of 13) Developed with @FakeGreenDress. Record, stream, and export Kinect mocap data to After Effects puppet pins. Record directly from the Kinect or over OSC. Compiling or running from source requires SimpleOpenNI.
Stars: ✭ 40 (+73.91%)
Mutual labels:  after-effects
Wiki
A wiki about ExtendScript features, tricks, workarounds, magic and rainbow unicorns
Stars: ✭ 161 (+600%)
Mutual labels:  after-effects
Lottie React Native
Lottie wrapper for React Native.
Stars: ✭ 14,707 (+63843.48%)
Mutual labels:  after-effects
ae-ease-to-gsap-customease
Converts the keyframes of the selected property in After Effects to a set of SVG path commands that can be used directly in GreenSock's CustomEase plugin
Stars: ✭ 58 (+152.17%)
Mutual labels:  after-effects
jsxbin
Convert jsx ExtendScript files into jsxbin files using ExtendScript Toolkit
Stars: ✭ 73 (+217.39%)
Mutual labels:  after-effects

create-expression-lib 🐱‍👤

Typescript to Rollup to After Effects

Editor Preview


A CLI for creating Expression Libraries for After Effects, in TypeScript.

npx create-expression-lib

Why?

At Motion Developer we maintain a lot of expression (.jsx) libraries, such as eKeys, eBox, and aeFunctions. This allows us to:

  • Share code between expressions and projects
  • Edit code in powerful editor (such as VS Code)
  • Improve performance
  • Build abstractions for complex tasks

For more info on writing expressions in .jsx files, see our article: How to write expressions in external jsx files

create-expression-lib is a CLI to create After Effects expression libraries, that enables you to:

  • Write in TypeScript (.ts files)
  • Split expressions into multiple files, to be bundled at build time
  • Write syntactically correct JavaScript, allowing:
    • Testing
    • Linting
    • Automatic formatting

Requirements

To use this template you need to have Node installed on your system.

For the best experience, it's recommended you also install and use:

Creating the library

npx create-expression-lib project-name
cd project-name

Arguments:

  • --install: install npm packages (-i)
  • --git: initialize with git repo (-g)
  • --yes: skip prompts (-y)

This sets up all the files necessary in a 'project-name' folder to create expression libraries in TypeScript.

Edit your library

If you didn't install the packages when creating the library with --install make sure to run npm install.

  1. Start Rollup

    Start Rollup in watch mode to automatically refresh your code as you make changes, by running:

    npm run watch

    You can run also run a once off build: npm run build

  2. Edit the src files

    The index.ts contains an example expression setup.

    Any values exported from this file will be included in your library, for example:

    export { someValue };
  3. Import the dist file into After Effects

    Use the compiled output file as you would any other .jsx library. Any changes to the src files will be live updated, and After Effects will update the result of your expression.

  4. Distribute releases

    To distribute your output file using Github releases (via Hub), use the command:

    npm run release

    This will use the GitHub CLI to create a new tag and release

    The release version number is the "version" in package.json, and it will attach the "main" file to the release.

    You can add this version to the output file by placing the string _npmVersion in your code, which will be replaced with the version number in package.json at build time.

After Effects API

This template uses the expression-globals-typescript package to provide types for the expressions API.

Classes

To create layers, compositions and properties, you can use the classes exported from the library. For example:

import { Comp, Layer } from "expression-globals-typescript";
const thisComp = new Comp();
const thisLayer = new Layer();

To create properties (such as position or scale), you can use the Property class.

import { Property, Vector } from "expression-globals-typescript";
const thisProperty = new Property<Vector>([0, 100]);

The Property constructor takes a value to set as the property value, and a type (<>) to set as the type for the property.

After Effects Types

You can import After Effect's specific types such as Color and Vector from the package to properly type your expressions.

To see all the Types and Base Objects available, see the expression-globals-typescript source code.

Testing

You can test your expression library code using Jest, which comes pre-configured in this template repo.

You write tests in the index.test.ts file, importing the code you want to test from index.ts, for example:

import { welcome } from "./index";

test("returns correct welcome string", () => {
  expect(welcome("test")).toEqual("Welcome test!");
});

And then run the test suite:

npm run test

Which will run Jest in watch mode.

You can learn more about testing using Jest from the Jest docs.

Configuration

There a couple of files you may wish to change to reflect the content of your project:

  • package.json:
    • version: The current version of the library, which is used for releases and added to dist files.
    • main: The build output file which will be attached to releases
  • rollup.config.js:
    • input: The source file to be built
    • typescript(): Custom typescript compiler options

How

  • expression-globals-typescript mocks the After Effects expressions API in typescript, so you can use global functions and objects such as linear() and time, while also providing expression specific types such as Layer.

  • Rollup is a lightweight module bundler that handles outputting the .jsx file via the plugins below.

  • The Rollup Typescript plugin runs the TypeScript compiler

  • The Rollup plugin rollup-plugin-ae-jsx transforms the JavaScript output into After Effects JSON (.jsx) compliant syntax

  • Testing via Jest, and ts-jest

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].