Developer Guide
PHP filters and actions for extending Etch Motion. Custom preset registration and scanner hooks.
Available Filters
etch_motion_scan_content — modify content before the scanner processes it. etch_motion_gsap_modules — add or remove GSAP modules from the scan result. etch_motion_presets — add custom presets or modify existing ones. etch_motion_css_initial — modify the initial-state CSS for a preset.
// Add a custom GSAP module
add_filter('etch_motion_gsap_modules', function($modules) );
// Force ScrollTrigger on specific pages
add_filter('etch_motion_gsap_modules', function($modules) );Available Actions
etch_motion_init — fires when the plugin initializes. etch_motion_before_enqueue — fires before scripts are enqueued, receives module list. etch_motion_after_enqueue — fires after scripts are enqueued, receives module list.
add_action('etch_motion_before_enqueue', function($modules) );Registering Custom Presets
Add custom presets via the etch_motion_presets filter. Each preset must include: label, category, defaults (trigger, duration, ease, scroll-start, once), initial (starting state), animate (ending state), requires (GSAP modules), css_initial (initial-state CSS).
add_filter('etch_motion_presets', function($presets) );Preset IDs must be lowercase, alphanumeric, hyphens only. Invalid IDs are sanitized automatically.