How effects and composition work
developmentTachyonFX is built on three core concepts:
- Effects are stateful: You create an effect once and apply it every frame.
- Effects transform rendered content: Effects are applied to the buffer after your widgets have been rendered.
- Effects compose: You can build complex animations by layering or chaining simple effects.
Composition Patterns
Parallel Execution: Run multiple effects at the same time using fx::parallel.
let effects = fx::parallel(&[
fx::fade_from_fg(Color::Red, 500),
fx::sweep_in(Motion::LeftToRight, 10, 0, Color::Black, 800),
]);Sequential Execution: Chain effects to run one after another using fx::sequence.
let effects = fx::sequence(&[
fx::fade_from_fg(Color::Black, 300),
fx::coalesce(500),
]);// Run multiple effects in parallel
let effects = fx::parallel(&[
fx::fade_from_fg(Color::Red, 500),
fx::sweep_in(Motion::LeftToRight, 10, 0, Color::Black, 800),
]);
// Or sequence them
let effects = fx::sequence(&[
fx::fade_from_fg(Color::Black, 300),
fx::coalesce(500),
]);