3 Filters Distortion and Motion
Flaig edited this page 2026-10-18 13:54:35 +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.

Distortion and Motion

Filters that move, warp or blur pixels. Strong distortions may need extra padding.

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.

blur · zoomblur · twist · bulgepinch · shockwave · wave · distortion · transform · images

blur

Blur. Gaussian blur, optionally different per axis.

Default zOrder 290 · built-in padding 16

Parameter Type Default Animate Description
blendMode number 0 yes PIXI blend mode number used to draw the result: 0 normal, 1 add, 2 multiply, 3 screen.
blur number 2 yes Blur strength on both axes.
blurX number 2 yes Horizontal blur.
blurY number 2 yes Vertical blur.
quality number 4 no (construction) Blur passes, 1–16.
repeatEdgePixels boolean false — Repeat edge pixels instead of blurring into transparency.
await leanFX.addUpdateFiltersOnSelected([{
  filterType: "blur",
  filterId: "blur",
  quality: 4,
  blur: 0,
  animated: {
    blurX: {animType: "syncCosOscillation", loopDuration: 500, val1: 0, val2: 6},
    blurY: {animType: "syncCosOscillation", loopDuration: 750, val1: 0, val2: 6}
  }
}]);

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.

zoomblur

Zoom Blur. Radial motion blur from the center.

Default zOrder 300

Parameter Type Default Animate Description
innerRadiusPercent number 10 yes Unblurred inner radius, in percent of the size.
radiusPercent number 50 yes Outer radius of the blur, in percent of the size.
strength number 0.1 yes Blur strength.
await leanFX.addUpdateFiltersOnSelected([{
  filterType: "zoomblur",
  filterId: "zoomblur",
  strength: 0.15,
  innerRadiusPercent: 65,
  radiusPercent: 100,
  animated: {innerRadiusPercent: {animType: "sinOscillation", loopDuration: 500, val1: 65, val2: 75}}
}]);

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.

twist

Twist. Swirls the image around its center.

Default zOrder 240 · built-in padding 20

Parameter Type Default Animate Description
angle number 4 yes Twist angle in radians; negative values twist the other way.
radiusPercent number 50 yes Twist radius, in percent of the size.
await leanFX.addUpdateFiltersOnSelected([{
  filterType: "twist",
  filterId: "twist",
  radiusPercent: 120,
  angle: 0,
  animated: {angle: {animType: "sinOscillation", loopDuration: 10000, val1: -1.885, val2: 1.885}}
}]);

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.

bulgepinch

Bulge / Pinch. Bulges the image outward or pinches it inward.

Default zOrder 140

Parameter Type Default Animate Description
anchorX number 0.5 yes Horizontal center of the effect as a fraction of the filtered area: 0 left, 0.5 middle, 1 right.
anchorY number 0.5 yes Vertical center of the effect as a fraction of the filtered area: 0 top, 0.5 middle, 1 bottom.
radiusPercent number 100 yes Affected radius, in percent of the size.
strength number 0 yes -1–1: positive bulges, negative pinches.
await leanFX.addUpdateFiltersOnSelected([{
  filterType: "bulgepinch",
  filterId: "bulge",
  padding: 150,
  radiusPercent: 200,
  strength: 0,
  animated: {strength: {animType: "cosOscillation", loopDuration: 2000, val1: 0, val2: 0.45}}
}]);

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.

shockwave

Shockwave. An expanding ring wave from the center.

Default zOrder 220

Parameter Type Default Animate Description
amplitude number 5 yes Wave height.
brightness number 1.5 yes Ring brightness; 1 unchanged.
radius number 200 yes Maximum radius in pixels; -1 for no limit.
speed number 50 yes Ring speed in pixels per time unit.
time number 0 yes Wave progress; animate it to move the ring.
wavelength number 100 yes Wave width in pixels.
await leanFX.addUpdateFiltersOnSelected([{
  filterType: "shockwave",
  filterId: "shockwave",
  amplitude: 8,
  wavelength: 75,
  radius: 500,
  brightness: 1.5,
  speed: 25,
  animated: {time: {animType: "cosOscillation", loopDuration: 1800, val1: 0, val2: 10}}
}]);

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.

wave

Waves. Concentric light waves rippling over the image.

Default zOrder 280

Parameter Type Default Animate Description
anchorX number 0.5 yes Horizontal center of the effect as a fraction of the filtered area: 0 left, 0.5 middle, 1 right.
anchorY number 0.5 yes Vertical center of the effect as a fraction of the filtered area: 0 top, 0.5 middle, 1 bottom.
color color 0xffffff color modes Effect color as a number, 0xRRGGBB.
frequency number 35 yes Number of waves.
inward boolean false — Move the waves inward instead of outward.
maxIntensity number 3.5 yes Light intensity on the wave crests.
minIntensity number 1.2 yes Light intensity in the wave troughs.
strength number 0.01 yes Distortion strength of each wave.
time number 0 yes Shader clock. Static values freeze one frame; animate it with move (see the example) to make the effect flow.
await leanFX.addUpdateFiltersOnSelected([{
  filterType: "wave",
  filterId: "waves",
  strength: 0.015,
  frequency: 120,
  color: 0xffffff,
  maxIntensity: 2.5,
  minIntensity: 0.9,
  padding: 10,
  animated: {time: {animType: "move", speed: 0.0085}}
}]);

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.

distortion

Distortion. Displaces pixels with a scrolling noise map: heat haze, underwater, invisibility.

Uses the included modules/leanFX/assets/distortion-1.png unless maskPath names another displacement map. This filter is sticky by default.

Default zOrder 4000 · built-in padding 15 · sticky by default

Parameter Type Default Animate Description
anchorSet number 0.5 no (construction) Anchor of the map, 0–1. Construction option.
maskPath path modules/leanFX/assets/distortion-1.png — Displacement map image. Construction option.
maskSpritePivotX number 0 yes Map pivot X in pixels.
maskSpritePivotY number 0 yes Map pivot Y in pixels.
maskSpriteRotation number 0 yes Map rotation in radians.
maskSpriteScaleX number 4 yes Horizontal displacement strength.
maskSpriteScaleY number 4 yes Vertical displacement strength.
maskSpriteSkewX number 0 yes Map skew X.
maskSpriteSkewY number 0 yes Map skew Y.
maskSpriteX number 0 yes Map offset X in pixels; animate with move to make the distortion flow.
maskSpriteY number 0 yes Map offset Y in pixels; animate with move to make the distortion flow.
sticky boolean true — Rotate the distortion with the object (default true for this filter).
await leanFX.addUpdateFiltersOnSelected([{
  filterType: "distortion",
  filterId: "distortion",
  maskSpriteScaleX: 5,
  maskSpriteScaleY: 5,
  padding: 20,
  animated: {maskSpriteX: {animType: "move", speed: 0.05}, maskSpriteY: {animType: "move", speed: 0.07}}
}]);

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.

transform

Transform. Moves, scales, rotates, twists or bulges the image inside its filter area: wobbles, hovering, breathing.

Give it enough padding for the moved image to stay inside the filter area.

Default zOrder 1000

Parameter Type Default Animate Description
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.
pivotX number 0.5 yes Rotation and scale center X, 0–1.
pivotY number 0.5 yes Rotation and scale center Y, 0–1.
rotation number 0 yes 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: "transform",
  filterId: "breathing",
  padding: 12,
  animated: {
    scaleX: {animType: "sinOscillation", loopDuration: 6000, val1: 0.985, val2: 1.015},
    scaleY: {animType: "sinOscillation", loopDuration: 6200, val1: 0.985, val2: 1.015},
    rotation: {animType: "cosOscillation", loopDuration: 8000, val1: -0.5, val2: 0.5}
  }
}]);

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.

images

Mirror Images. Shifted copies of the image, like a blink or mirror-image spell.

The example sets alphaChr: 0, which deliberately hides the original image and draws only its copies. Use alphaChr: 1 to keep the original visible.

Default zOrder 100

Parameter Type Default Animate Description
alphaChr number 1 yes Opacity of the original, 0–1.
alphaImg number 0.5 yes Opacity of the copies, 0–1.
ampX number 0.15 yes Horizontal movement of the copies, as a fraction of the size.
ampY number 0.15 yes Vertical movement of the copies, as a fraction of the size.
blend number 4 yes How the effect is mixed with the image. See Blend Modes.
nbImage number 4 yes Number of copies, 1–8.
time number 0 yes Shader clock. Static values freeze one frame; animate it with move (see the example) to make the effect flow.
await leanFX.addUpdateFiltersOnSelected([{
  filterType: "images",
  filterId: "images",
  nbImage: 4,
  alphaImg: 1,
  alphaChr: 0,
  blend: 4,
  ampX: 0.1,
  ampY: 0.1,
  animated: {time: {animType: "move", speed: 0.001}}
}]);

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.