Squashed 'test/' content from commit f2edc20
git-subtree-dir: test git-subtree-split: f2edc20cba865a6ef67ca807c2ed6cee8e6c2836
This commit is contained in:
28
templates/scan-oscillating-spin.sexp
Normal file
28
templates/scan-oscillating-spin.sexp
Normal file
@@ -0,0 +1,28 @@
|
||||
;; Oscillating Spin Scan
|
||||
;;
|
||||
;; Accumulates rotation angle on each beat, reversing direction
|
||||
;; periodically for an oscillating effect.
|
||||
;;
|
||||
;; Required context:
|
||||
;; - music: audio analyzer from (streaming:make-audio-analyzer ...)
|
||||
;;
|
||||
;; Provides scan: spin
|
||||
;; Bind with: (bind spin :angle) ;; cumulative rotation angle
|
||||
;;
|
||||
;; Behavior:
|
||||
;; - Rotates 14.4 degrees per beat (completes 360 in 25 beats)
|
||||
;; - After 20-30 beats, reverses direction
|
||||
;; - Creates a swinging/oscillating rotation effect
|
||||
;;
|
||||
;; Usage:
|
||||
;; (include :path "../templates/scan-oscillating-spin.sexp")
|
||||
;;
|
||||
;; In frame:
|
||||
;; (rotate frame :angle (bind spin :angle))
|
||||
|
||||
(scan spin (streaming:audio-beat music t)
|
||||
:init {:angle 0 :dir 1 :left 25}
|
||||
:step (if (> left 0)
|
||||
(dict :angle (+ angle (* dir 14.4)) :dir dir :left (- left 1))
|
||||
(dict :angle angle :dir (* dir -1)
|
||||
:left (+ 20 (mod (streaming:audio-beat-count music t) 11)))))
|
||||
Reference in New Issue
Block a user