Convert effects to new single-file format

- dog: Convert to whole-video API with PEP 723 metadata
- identity: Add as frame-by-frame effect

Both now use @-tag docstrings for AI-readable metadata.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-12 06:52:07 +00:00
parent 89d8f4f464
commit f9d9e8c5fb
2 changed files with 55 additions and 11 deletions

35
identity/effect.py Normal file
View File

@@ -0,0 +1,35 @@
# /// script
# requires-python = ">=3.10"
# dependencies = []
# ///
"""
@effect identity
@version 1.0.0
@author @giles@artdag.rose-ash.com
@temporal false
@description
Identity effect - returns input unchanged. This is the foundational
effect where identity(x) = x. Uses frame-by-frame API but simply
passes frames through unmodified.
@example
(fx identity)
"""
import numpy as np
def process_frame(frame: np.ndarray, params: dict, state) -> tuple:
"""
Identity: return frame unchanged.
Args:
frame: RGB frame as numpy array (H, W, 3)
params: Unused
state: Passed through unchanged
Returns:
(frame, state) - both unchanged
"""
return frame, state