2 Coming from Token Magic FX
Flaig edited this page 2026-10-08 16:22:28 +02:00

Coming from Token Magic FX

leanFX started as Token Magic FX with everything but the filter engine removed, then rebuilt around it for Foundry v14. The filters, their parameters and the animation modes are the same, so most Token Magic FX filter definitions work with small changes.

What stays the same

  • The 45 filter types and their names (glow, xglow, field, fire, ...).
  • Filter parameters and their defaults, zOrder, padding (with the same 50 px minimum margin), gridPadding and sticky.
  • The animation modes and their options (animType, loopDuration, val1, val2, loops, ...).
  • Method names such as addUpdateFilters, deleteFilters and addUpdateFiltersOnSelected.

What is different

Token Magic FX leanFX
TokenMagic.addUpdateFilters(...) leanFX.addUpdateFilters(...), also game.modules.get("leanFX").api
Presets by name, preset library, gallery None. Keep your specs in macros or your module.
Token HUD button, filter editor None.
Automatic template and spell effects None.
Several filters can share one filterId One filterId is one filter. Use a different ID per filter in a stack.
Unknown parameters are ignored Unknown parameters are rejected with an error.
loops: Infinity loops: null, or leave it out.
autoDestroy, autoDisable Legacy fields are rejected. Use onComplete: "delete" for automatic removal after finite animations; the default "hold" keeps the endpoint.
randomized Not available; randomize in your macro before calling leanFX.
syncShift in milliseconds for syncRotation A fraction of a loop in every mode.
moveToward Moves from val1 to val2 within each loop.
randomNumberPerLoop starts on the second loop Picks a value for the first loop too.
Measured templates Not supported; use Regions.
Video textures in image filters Not supported.
...OnTargeted helpers Loop over game.user.targets (example).
Saved in flags.tokenmagic Saved in flags.leanFX. Existing Token Magic FX effects are not read or converted.

Other keys Token Magic FX passed through, such as zIndex (it changed the object's sort order) or autoFit, are rejected; leanFX only changes the filters, never the object.

Converting a preset

Take the preset's params array, give each filter a unique filterId, remove keys leanFX rejects and pass the result to addUpdateFilters:

// Token Magic FX "fire" preset, converted
await leanFX.addUpdateFiltersOnSelected([{
  filterType: "fire", filterId: "fire", intensity: 1, color: 0xffffff, amplitude: 1, blend: 2, fireBlend: 1,
  animated: {
    time: {animType: "move", speed: -0.0024},
    intensity: {animType: "syncCosOscillation", loopDuration: 15000, val1: 0.8, val2: 2},
    amplitude: {animType: "syncCosOscillation", loopDuration: 4400, val1: 1, val2: 1.4}
  }
}]);

If a key is rejected, the error names it. leanFX.parameters("fire") lists what a filter accepts.

Running both

leanFX and Token Magic FX are separate modules with separate data. Using both on the same object at the same time is untested.