Created
November 6, 2025 20:14
-
-
Save osnr/c6370ccdd7f78eae3fd5ca8f80484006 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set COLS 3 | |
| Wish tag $this is stabilized | |
| Wish $this is outlined green | |
| Wish $this-display has a canvas with settle 2ms width 1024 height 1024 | |
| When display /disp/ has width /displayWidth/ height /displayHeight/ &\ | |
| display /disp/ has intrinsics /displayIntrinsics/ &\ | |
| the pose library is /poseLib/ &\ | |
| the quad library is /quadLib/ &\ | |
| the quad changer is /quadChange/ &\ | |
| $this has resolved geometry /geom/ &\ | |
| the animation toy's frame count is /N_FRAMES/ { | |
| set frameGeom [list width [* $geom(width) 0.3] \ | |
| height [* $geom(height) 0.3]] | |
| Claim $this-display has resolved geometry $frameGeom | |
| for {set i 1} {$i <= $N_FRAMES} {incr i} { | |
| Claim $this-frame-$i has resolved geometry $frameGeom | |
| When /someone/ wishes $this-frame-$i is outlined /color/ &\ | |
| $this-frame-$i has quad /frameQuad/ { | |
| set dispQuad [quadChange $frameQuad "display $disp"] | |
| set dispPoints [lmap v [$quadLib vertices $dispQuad] { | |
| $poseLib project $displayIntrinsics \ | |
| $displayWidth $displayHeight $v | |
| }] | |
| lappend dispPoints [lindex $dispPoints 0] | |
| Wish to draw a line onto $disp with points $dispPoints \ | |
| width 4 color $color | |
| } | |
| } | |
| } | |
| When the quad library is /quadLib/ & $this has quad /q/ { | |
| set displayQuad [$quadLib scale $q 30%] | |
| set displayQuad [$quadLib move $displayQuad up 120% right 215%] | |
| Claim $this-display has quad $displayQuad | |
| Wish $this-display is outlined white | |
| } | |
| When the quad library is /quadLib/ &\ | |
| $this-display has quad /d/ &\ | |
| the animation toy's fps is /FPS/ &\ | |
| the animation toy's frame count is /N_FRAMES/ { | |
| Wish $this is labelled "FPS: $FPS" | |
| Wish $this is labelled "Frame count: $N_FRAMES" | |
| for {set i 1} {$i <= $N_FRAMES} {incr i} { | |
| set col [expr {($i - 1) % $COLS}] | |
| set row [expr {($i - 1) / $COLS}] | |
| set frame_quad [$quadLib move $d \ | |
| down 300% right ${col}00% down ${row}00%] | |
| Claim $this-frame-$i has quad $frame_quad | |
| When the clock time is /t/ & $this-frame-$i has camera slice /slice/ { | |
| if {round($t * $FPS) % $N_FRAMES == ($i - 1)} { | |
| Wish (keep 10ms) $this-frame-$i is outlined green | |
| Wish (keep 10ms) $this-display displays image $slice | |
| } else { | |
| Wish (keep 10ms) $this-frame-$i is outlined red | |
| } | |
| } | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment