EFFECT_DEFINITION
An effect definition breaks a rule, such as a reserved param name, so the effect cannot be defined or registered.
On this page
EFFECT_DEFINITION: param "{key}" is a built-in input or reserved namedefineEffect and effect() check the definition when the module runs. They throw one error that lists every problem found, joined with ; , so the message above is one of several possible problems.
Why it happens
- A param has the name of a built-in input (
pointer,pointerWorld,hover,velocity,progress,pin,size,time,hoverTime,motion,opacity,presence) or of a reserved attribute (key,state,track,load,preload,progress,vt,transition). - A param name is not lowerCamelCase (
param "{key}" must be lowerCamelCase), or it is the name of an option such aswhen,media,rebuildorquality(param "{key}" is a reserved name of an option). - A param default has an unsupported type,
rebuildnames a param the effect does not declare,setupis not a function,whenis not a string,presenceis neither'fade'nor'custom', oronis not a valid CSS selector. - The effect name is not kebab-case, or it is one of the reserved attribute names.
app.attach()gets a definition whose name is already registered for a different definition. This case is reported instead of thrown, with the messagename "{name}" is taken by another definition; use register() to replace, and the handle stays inert.- The
qualityfield is malformed, for examplequality.minis not a tier or a cap is not a finite number. The runtime reports this when the first instance mounts, and that instance becomesfailed. - A GLSL effect from
@dioramajs/glsldeclares params, uniforms or textures that do not match its shaders. All problems arrive as one error when the effect module is imported.
How to fix
Rename the param. Built-in inputs stay readable on ctx.u, so the effect does not need a param for them:
import { defineEffect } from '@dioramajs/diorama'
export default defineEffect({ name: 'brighten', // `progress: 0` here throws EFFECT_DEFINITION: // progress is a built-in input. params: { strength: 0 }, setup({ params, u }) { return () => { // Read the input as u.progress and the param as params.strength. } },})To replace an effect under a name that is already taken, pass it to start() instead of app.attach(). A matching name replaces the built-in or folder effect:
import { start } from '@dioramajs/diorama'import ripple from './my-ripple'
export const app = start({ effects: { ripple } })