Files
rose-ash/artdag/test/templates/scan-ripple-drops.sexp
giles 1a74d811f7
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m33s
Incorporate art-dag-mono repo into artdag/ subfolder
Merges full history from art-dag/mono.git into the monorepo
under the artdag/ directory. Contains: core (DAG engine),
l1 (Celery rendering server), l2 (ActivityPub registry),
common (shared templates/middleware), client (CLI), test (e2e).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

git-subtree-dir: artdag
git-subtree-mainline: 1a179de547
git-subtree-split: 4c2e716558
2026-02-27 09:07:23 +00:00

42 lines
1.5 KiB
Common Lisp

;; Beat-Triggered Ripple Drops Scan
;;
;; Creates random ripple drops triggered by audio beats.
;; Each drop has a random center position and duration.
;;
;; Required context:
;; - music: audio analyzer from (streaming:make-audio-analyzer ...)
;; - core primitives loaded
;;
;; Provides scan: ripple-state
;; Bind with: (bind ripple-state :gate) ;; 0 or 1
;; (bind ripple-state :cx) ;; center x (0-1)
;; (bind ripple-state :cy) ;; center y (0-1)
;;
;; Parameters:
;; trigger-chance: probability per beat (default 0.15)
;; min-duration: minimum beats (default 1)
;; max-duration: maximum beats (default 15)
;;
;; Usage:
;; (include :path "../templates/scan-ripple-drops.sexp")
;; ;; Uses default: 15% chance, 1-15 beat duration
;;
;; In frame:
;; (let [rip-gate (bind ripple-state :gate)
;; rip-amp (* rip-gate (core:map-range e 0 1 5 50))]
;; (ripple frame
;; :amplitude rip-amp
;; :center_x (bind ripple-state :cx)
;; :center_y (bind ripple-state :cy)))
(scan ripple-state (streaming:audio-beat music t)
:init {:gate 0 :cx 0.5 :cy 0.5 :left 0}
:step (if (> left 0)
(dict :gate 1 :cx cx :cy cy :left (- left 1))
(if (< (core:rand) 0.15)
(dict :gate 1
:cx (+ 0.2 (* (core:rand) 0.6))
:cy (+ 0.2 (* (core:rand) 0.6))
:left (+ 1 (mod (streaming:audio-beat-count music t) 15)))
(dict :gate 0 :cx 0.5 :cy 0.5 :left 0))))