2 Filters Images
Flaig edited this page 2026-10-08 00:32:15 +02:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Images

Filters that draw another image. imagePath is loaded before the filter is built; videos are not supported.

Example status: these are parameter demonstrations, many adapted from TokenMagicFX. Every example passes leanFX's validator. Live appearance checks are recorded below each macro; matching colours and the result still depend on your source image. These checks do not establish long-running stability. Some examples intentionally darken or hide the original image.

Columns: Default is the value used when the spec omits the parameter. Animate says whether it can be driven by animated (Animation). Construction options are fixed when the filter is built; changing them rebuilds it.

sprite · spriteMask · polymorph

sprite

Image Overlay. Draws an image over (or under) the object.

Default zOrder 0

Parameter Type Default Animate Description
alpha number 1 yes Image opacity, 0–1.
alphaDiscard boolean false — Discard the faint, dark parts of the effect instead of drawing them.
bpRadiusPercent number 0 yes Radius of the bulge/pinch, in percent of the image size. 0 turns it off.
bpStrength number 0 yes Bulge (positive) or pinch (negative), about -1–1.
color color 0x000000 color modes Colorize color (with colorize).
colorize boolean false — Recolor the image with color.
imagePath path required — Image to use: a Foundry path such as icons/svg/fire.svg, a URL, or a #virtual texture. Videos are not supported.
inverse boolean false — Invert the image's colors.
maintainAspectRatio boolean false — Keep the image's aspect ratio instead of stretching it to the target.
maintainScale boolean false — Keep the image's pixel size instead of fitting it to the target.
repeat boolean false — Tile the image.
rotation number 0 yes Image rotation in degrees.
scale number 1 yes Uniform scale; sets scaleX and scaleY together.
scaleX number 1 yes Horizontal scale.
scaleY number 1 yes Vertical scale.
top boolean false — Draw over the object instead of under it.
translationX number 0 yes Horizontal offset as a fraction of the image width.
translationY number 0 yes Vertical offset as a fraction of the image height.
twAngle number 0 yes Twist strength in radians.
twRadiusPercent number 0 yes Radius of the twist, in percent of the image size. 0 turns the twist off.
twRotation number 0 yes Twist strength in degrees; an alternative to twAngle.
await leanFX.addUpdateFiltersOnSelected([{
  filterType: "sprite",
  filterId: "overlay",
  imagePath: "icons/svg/fire.svg",
  alpha: 0.8,
  top: true,
  colorize: true,
  color: 0xff6600,
  scale: 0.5,
  animated: {rotation: {animType: "rotation", loopDuration: 6000}}
}]);

Visual check: User marked this example working on a Token in Foundry v14 on 2026-10-08. Other images and target types still need their own visual check.

spriteMask

Image Mask. Shows the object only where the image is opaque.

Default zOrder 0

Parameter Type Default Animate Description
alpha number 1 yes Mask strength, 0–1.
bpRadiusPercent number 0 yes Radius of the bulge/pinch, in percent of the image size. 0 turns it off.
bpStrength number 0 yes Bulge (positive) or pinch (negative), about -1–1.
imagePath path required — Image to use: a Foundry path such as icons/svg/fire.svg, a URL, or a #virtual texture. Videos are not supported.
maintainAspectRatio boolean false — Keep the image's aspect ratio instead of stretching it to the target.
maintainScale boolean false — Keep the image's pixel size instead of fitting it to the target.
repeat boolean false — Tile the mask image.
rotation number 0 yes Mask rotation in degrees.
scale number 1 yes Uniform scale; sets scaleX and scaleY together.
scaleX number 1 yes Horizontal scale.
scaleY number 1 yes Vertical scale.
translationX number 0 yes Horizontal offset as a fraction of the image width.
translationY number 0 yes Vertical offset as a fraction of the image height.
twAngle number 0 yes Twist strength in radians.
twRadiusPercent number 0 yes Radius of the twist, in percent of the image size. 0 turns the twist off.
twRotation number 0 yes Twist strength in degrees; an alternative to twAngle.
await leanFX.addUpdateFiltersOnSelected([{filterType: "spriteMask", filterId: "mask", imagePath: "icons/svg/explosion.svg", scale: 1}]);

Visual check: User marked this example working on a Token in Foundry v14 on 2026-10-08. Other images and target types still need their own visual check.

polymorph

Polymorph. Transitions the object's image into another image.

Needs a textured target: a Token, Tile or text Drawing. Ordinary Drawings and Regions report an error in inspect().

Default zOrder 1

Parameter Type Default Animate Description
imagePath path required — The image to transform into.
magnify number 1 yes Zoom of the target image, 0.1–100.
progress number 0 yes Transition progress, 0–100.
type number 1 yes Transition: 1 simple, 2 dreamy, 3 swirl, 4 water drop, 5 TV noise, 6 morph, 7 crosswarp, 8 wind, 9 hologram.
await leanFX.addUpdateFiltersOnSelected([{
  filterType: "polymorph",
  filterId: "polymorph",
  imagePath: "icons/svg/mystery-man.svg",
  type: 6,
  animated: {progress: {animType: "halfCosOscillation", loopDuration: 1000, loops: 1, val1: 0, val2: 100}}
}]);

Visual check: User marked this example working on a Token in Foundry v14 on 2026-10-08. Other images and target types still need their own visual check.

Examples run on the selected placeables; see API Reference for other targets.