Skip to main content

react_morph_filter

Attribute Macro react_morph_filter 

Source
#[react_morph_filter]
Expand description

Turn a named-field struct into a typed custom morph filter — a two-input transition for the morphFilter style (blending the frozen old appearance into the live content on a key change).

Same expansion as react_filter (strict serde::Deserialize + ts_rs::TS, contiguous field-declaration-order packing, the same param type table, the same give-every-field-a-#[serde(default…)] guidance — JS types all params as optional), plus IS_MORPH = true and the ReactMorphFilter marker — register with add_react_morph_filter, and the name lands in the generated BevyMorphFilters interface. The two families are separate: a morph name inside filter/backdropFilter chains (and a regular filter name in morphFilter) warns and is skipped at resolve time.

Arguments (only these two — a morph re-renders while its blend is in flight and never inflates the capture rect, so outset/time do not apply):

  • name = "..." (optional) — the wire name; defaults to the struct ident with its first letter lowercased.
  • shader = "path/to.wgsl" (required) — the single blend pass. It must resolve to exactly ONE pass with user params within the morph cap of 6 vec4s (params[6..8] are engine-reserved), and follow the MORPH CONTRACT in crates/core/src/layer/filter_prelude.wgsl — sample via morph_sample_from()/morph_sample_to()/morph_progress() and output exactly the live sample at progress 1.0 (the identity contract).