Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b0961c9
Restore shapes, arcs, fills
cwervo Apr 27, 2026
96c0eaf
Merge branch 'main' into ac/drawing-primitives
cwervo Apr 28, 2026
5c7f9f2
Port drawing curve and shapes APIs
cwervo May 3, 2026
97178a0
Add physical drawing surfaces
cwervo May 3, 2026
2866c65
Port connections to draw spaces
cwervo May 3, 2026
796fd59
Move arc primitive into draw
cwervo May 3, 2026
d715909
Share drawing space geometry helpers
cwervo May 3, 2026
e70f275
Port decorations and hit targets to surfaces
cwervo May 3, 2026
28b8a83
Strengthen decoration surface tests
cwervo May 3, 2026
b409010
Port terminal to physical surfaces
cwervo May 3, 2026
2de73b2
Harden terminal lifecycle and focus fallback
cwervo May 3, 2026
a26ca34
Clean up drawing surface helper conventions
cwervo May 5, 2026
7b7d126
build: make remote sync work from git worktrees
cwervo May 6, 2026
374ae6d
draw: move primitives into the draw program space
cwervo May 6, 2026
0d02c56
draw: add demo runner and title source margins
cwervo May 6, 2026
568eac3
connections: restore quad-based drawing
cwervo May 6, 2026
ce8c292
draw/text: honor block anchors for aligned lines
cwervo May 6, 2026
016c83e
draw/image: make Folk logo URL work offline
cwervo May 7, 2026
d9e7c20
Clean up draw spaces and texture init
cwervo May 8, 2026
3e6dae9
Add shared PI and TAU constants
cwervo May 13, 2026
5da5157
Merge remote-tracking branch 'origin/main' into ac/drawing-primitives
cwervo May 13, 2026
ffd2279
Merge drawing primitives into drawing May PR branch
cwervo May 13, 2026
3bc7285
Stabilize live draw helper usage
cwervo May 13, 2026
ebee738
Add physical drawing surfaces and shared draw-space helpers
cwervo May 16, 2026
a44abbd
Port drawing APIs onto physical drawing surfaces
cwervo May 16, 2026
23d2434
Merge origin/main into ac/drawing-may-2026
cwervo May 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,17 @@ kill-folk:
fi

FOLK_REMOTE_NODE ?= folk-live
FOLK_SYNC_IGNORES_TMP := $(shell git rev-parse --git-path ignores.tmp 2>/dev/null || echo .git/ignores.tmp)

sync:
ssh $(FOLK_REMOTE_NODE) -t \
'cd ~/folk && git init > /dev/null && git ls-files --exclude-standard -oi --directory' \
> .git/ignores.tmp || true
git ls-files --exclude-standard -oi --directory >> .git/ignores.tmp
> $(FOLK_SYNC_IGNORES_TMP) || true
git ls-files --exclude-standard -oi --directory >> $(FOLK_SYNC_IGNORES_TMP)
rsync --timeout=15 -e "ssh -o StrictHostKeyChecking=no" \
--archive --delete --itemize-changes \
--exclude='/.git' \
--exclude-from='.git/ignores.tmp' \
--exclude-from='$(FOLK_SYNC_IGNORES_TMP)' \
--exclude='vendor/tracy/public/TracyClient.o' \
--include='vendor/tracy/public/***' \
--exclude='vendor/tracy/*' \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ Use it in an animation:

```
When the clock time is /t/ {
Wish $this draws a circle with offset [list [expr {sin($t) * 50}] 0]
Wish $this draws a circle with offset [list [expr {sin($t) * 0.05}] 0] radius 0.012
}
```

Expand Down
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
133 changes: 91 additions & 42 deletions builtin-programs/connections.folk
Original file line number Diff line number Diff line change
Expand Up @@ -3,67 +3,116 @@
# "Wish $tag is connected to $tag2" or "Wish $tag is dynamically connected to $tag2"

When /anyone/ wishes /source/ is connected to /sink/ {
Wish $source is connected to $sink from centroid to centroid
Wish $source is connected to $sink with from centroid to centroid
}
When /anyone/ wishes /source/ is connected to /sink/ from /from/ to /to/ {
Wish $source is connected to $sink with from $from to $to
}
When /anyone/ wishes /source/ is dynamically connected to /sink/ {
Wish $source is dynamically connected to $sink from centroid to centroid
Wish $source is dynamically connected to $sink with from centroid to centroid
}
When /anyone/ wishes /source/ is dynamically connected to /sink/ from /from/ to /to/ {
Wish $source is dynamically connected to $sink with from $from to $to
}

When /anyone/ wishes /source/ is connected to /sink/ /...options/ & \
/source/ has region /source_region/ & \
/sink/ has region /sink_region/ {
if {$source == $sink} {return}
fn drawConnectionArrowPoints {center radius radians} {
lassign $center cx cy
set dx [expr {cos($radians)}]
set dy [expr {sin($radians)}]
set spread [expr {$radius * 0.8}]
set baseX [expr {$cx - $dx * $radius}]
set baseY [expr {$cy - $dy * $radius}]
set tip [list [expr {$cx + $dx * $radius}] [expr {$cy + $dy * $radius}]]
set rearLeft [list [expr {$baseX + $dy * $spread}] [expr {$baseY - $dx * $spread}]]
set rearRight [list [expr {$baseX - $dy * $spread}] [expr {$baseY + $dx * $spread}]]
list $tip $rearLeft $rearRight
}

set p1 [dict_getdef $options from centroid]
set p2 [dict_getdef $options to centroid]
set source [region $p1 $source_region]
set sink [region $p2 $sink_region]
fn drawConnectionArrow {disp center radius radians color layer} {
if {$radius <= 0.0} { return }
lassign [drawConnectionArrowPoints $center $radius $radians] p0 p1 p2
Wish to draw a triangle onto $disp with \
p0 $p0 p1 $p1 p2 $p2 color $color layer $layer
}

set direction [vec2 sub $sink $source]
set color [dict_getdef $options color grey]
set layer [dict_getdef $options layer 0]
When the draw space library is /drawSpaceLib/ &\
the quad library is /quadLib/ &\
the pose library is /poseLib/ &\
the quad changer is /quadChange/ &\
display /disp/ has width /displayWidth/ height /displayHeight/ &\
display /disp/ has intrinsics /displayIntrinsics/ &\
/anyone/ wishes /source/ is connected to /sink/ with /...options/ &\
/source/ has quad /sourceQuad/ &\
/sink/ has quad /sinkQuad/ {
if {$source eq $sink} { return }
fn quadChange

set c [vec2 scale [vec2 add $source $sink] 0.5]
set angle [expr {atan2(-[lindex $direction 1], [lindex $direction 0]) - 3.14159/2}]
set p1 [$drawSpaceLib quadPoint $quadLib \
[quadChange $sourceQuad "display $disp"] \
[dict getdef $options from centroid]]
set p2 [$drawSpaceLib quadPoint $quadLib \
[quadChange $sinkQuad "display $disp"] \
[dict getdef $options to centroid]]
set from [$drawSpaceLib project $poseLib $displayIntrinsics $displayWidth $displayHeight $p1]
set to [$drawSpaceLib project $poseLib $displayIntrinsics $displayWidth $displayHeight $p2]

Wish to draw a stroke with points [list $source $sink] width 2 color $color layer $layer
Wish to draw a shape with sides 3 center $c radius 30 radians $angle color $color filled true layer $layer
set direction [$drawSpaceLib vectorSub $to $from]
if {[$drawSpaceLib vectorDistance $to $from] == 0.0} { return }
set color [dict getdef $options color grey]
set layer [dict getdef $options layer 0]

set c [$drawSpaceLib vectorMidpoint $from $to]
set angle [expr {atan2([lindex $direction 1], [lindex $direction 0])}]

Wish to draw a line onto $disp with \
points [list $from $to] width 2 color $color layer $layer
drawConnectionArrow $disp $c 30 $angle $color $layer
}

set speed 75
set spacing 50
set maxsize 25

When /anyone/ wishes /source/ is dynamically connected to /sink/ /...options/ & \
/source/ has region /source_region/ & \
/sink/ has region /sink_region/ {

if {$source == $sink} {return}
When the draw space library is /drawSpaceLib/ &\
the quad library is /quadLib/ &\
the pose library is /poseLib/ &\
the quad changer is /quadChange/ &\
display /disp/ has width /displayWidth/ height /displayHeight/ &\
display /disp/ has intrinsics /displayIntrinsics/ &\
/anyone/ wishes /source/ is dynamically connected to /sink/ with /...options/ &\
/source/ has quad /sourceQuad/ &\
/sink/ has quad /sinkQuad/ {

set p1 [dict_getdef $options from centroid]
set p2 [dict_getdef $options to centroid]
set source [region $p1 $source_region]
set sink [region $p2 $sink_region]
if {$source eq $sink} { return }
fn quadChange

set direction [vec2 normalize [vec2 sub $sink $source]]
set distance [vec2 distance $sink $source]
set angle [expr {atan2(-[lindex $direction 1], [lindex $direction 0]) - 3.14159/2}]
set p1 [$drawSpaceLib quadPoint $quadLib \
[quadChange $sourceQuad "display $disp"] \
[dict getdef $options from centroid]]
set p2 [$drawSpaceLib quadPoint $quadLib \
[quadChange $sinkQuad "display $disp"] \
[dict getdef $options to centroid]]
set from [$drawSpaceLib project $poseLib $displayIntrinsics $displayWidth $displayHeight $p1]
set to [$drawSpaceLib project $poseLib $displayIntrinsics $displayWidth $displayHeight $p2]

set color [dict_getdef $options color white]
set layer [dict_getdef $options layer 0]
set direction [$drawSpaceLib vectorSub $to $from]
set distance [$drawSpaceLib vectorDistance $to $from]
if {$distance == 0.0} { return }
set direction [$drawSpaceLib vectorScale $direction [expr {1.0 / $distance}]]
set angle [expr {atan2([lindex $direction 1], [lindex $direction 0])}]

lassign [vec2 scale [vec2 add $source $sink] 0.5] cx cy
set color [dict getdef $options color white]
set layer [dict getdef $options layer 0]

Wish to draw a stroke with points [list $source $sink] width 1 color $color layer $layer

When the clock time is /t/ {
set offset [expr {round($t*$speed) % $spacing}]
set count [expr {round($distance / $spacing)}]
Wish to draw a line onto $disp with \
points [list $from $to] width 1 color $color layer $layer

for {set p $offset} {$p < $distance} {incr p $spacing} {
set c [vec2 add $source [vec2 scale $direction $p]]
set s [expr {min($maxsize, 0.20*min($p, $distance - $p))}]
Wish to draw a shape with sides 3 center $c radius $s radians $angle color $color filled true layer $layer
}
When the clock time is /t/ {
set offset [expr {round($t*$speed) % $spacing}]
for {set p $offset} {$p < $distance} {incr p $spacing} {
set c [$drawSpaceLib vectorAdd $from [$drawSpaceLib vectorScale $direction $p]]
set s [expr {min($maxsize, 0.20*min($p, $distance - $p))}]
drawConnectionArrow $disp $c $s $angle $color $layer
}
}
}
4 changes: 2 additions & 2 deletions builtin-programs/demos.folk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Claim 45001 has demo code {
Claim 45002 has demo code {
When /actor/ is cool {
Wish $this is labelled "$actor is pretty cool"
Wish $actor is outlined red
Wish $actor is outlined red
}
}
Claim 45003 has demo code {
Expand All @@ -24,7 +24,7 @@ Claim 45004 has demo code {
}
Claim 45005 has demo code {
When the clock time is /t/ {
Wish $this draws a circle offset [list expr {sin($t) * 50} 0]
Wish $this draws a circle with offset [list [expr {sin($t) * 0.05}] 0] radius 0.012
}
}
Claim 45006 has demo code {
Expand Down
39 changes: 0 additions & 39 deletions builtin-programs/display/arc.folk

This file was deleted.

135 changes: 0 additions & 135 deletions builtin-programs/display/curve.folk

This file was deleted.

Loading