
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
create-expression-lib
Advanced tools


npx create-expression-lib
At Motion Developer we maintain a lot of expression (.jsx) libraries, such as eKeys, eBox, and aeFunctions. This allows us to:
For more info on writing expressions in
.jsxfiles, 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:.ts files)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:
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.
If you didn't install the packages when creating the library with --install make sure to run npm install.
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
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 };
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.
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
_npmVersionin your code, which will be replaced with the version number inpackage.jsonat build time.
This template uses the
expression-globals-typescriptpackage to provide types for the expressions API.
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
Propertyconstructor takes a value to set as the property value, and a type (<>) to set as the type for the property.
You can import After Effect's specific types such as Color and Vector from the package to properly type your expressions.
expression-globals-typescript source code.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.
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 releasesrollup.config.js:
input: The source file to be builttypescript(): Custom typescript compiler optionsexpression-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
FAQs
A CLI to create After Effects expression libraries, in TypeScript
We found that create-expression-lib demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.