A drawing app built for agent/human collaboration
Rust
README shows one recording: the creature painted, changed and animated, with the editor beside the terminal
Indicode BV2c3bedda4d61
diff --git a/README.md b/README.mdindex 77a2f73..8a58325 100644--- a/README.md+++ b/README.md@@ -6,13 +6,9 @@**There is no image model in klad.** Your agent (Claude Code, Codex, anything that can run commands) decides what to paint; klad gives it brushes, layers and a timeline. Whatever either of you puts down stays what it was: a stroke with its path, pressure, brush and colour, a shape with its points, a fill with its region. So there's no rerolling and hoping for the best: if one leaf looks off, you fix that leaf.-+-*Asked for "a little sprout creature for my game", the agent paints 4,333 strokes. Then you change them: recolour the leaves, bend the mouth, move a smudge, blend the blush.*----*Then the agent makes it walk: the creature's parts go into five groups, 205 keys move them, and no frame is painted again.*+*Asked for "a little sprout creature for my game", the agent paints 4,344 strokes and fills. You change them: recolour the leaves, bend the mouth, move a smudge, blend the blush. Then the agent animates it: the creature's parts go into five groups, 205 keys move them, and no frame is painted again.*| | ||---|---|diff --git a/crates/app/src/editor/ui_tests.rs b/crates/app/src/editor/ui_tests.rsindex 3baf8ed..dd59e7f 100644--- a/crates/app/src/editor/ui_tests.rs+++ b/crates/app/src/editor/ui_tests.rs@@ -4807,7 +4807,11 @@ fn guide_pictures() {}fn editor_picture(source: &Path, layer: &str, moment: Moment, out: &Path) {- let name = out.file_stem().unwrap().to_string_lossy().to_string();+ editor_pictures(source, layer, moment, &[(None, out.to_path_buf())]);+}++fn editor_pictures(source: &Path, layer: &str, moment: Moment, shots: &[(Option<u32>, PathBuf)]) {+ let name = shots[0].1.file_stem().unwrap().to_string_lossy().to_string();let dir = std::env::temp_dir().join(format!("draw-guide-{name}-{}", std::process::id()));let _ = std::fs::remove_dir_all(&dir);std::fs::create_dir_all(&dir).unwrap();@@ -4852,7 +4856,13 @@ fn editor_picture(source: &Path, layer: &str, moment: Moment, out: &Path) {}moment(ed).unwrap();settle(&mut h);- h.render().unwrap().save(out).unwrap();+ shots.iter().for_each(|(frame, out)| {+ if let Some(frame) = frame {+ h.state_mut().editor.as_mut().unwrap().go_to(*frame).unwrap();+ settle(&mut h);+ }+ h.render().unwrap().save(out).unwrap();+ });std::fs::remove_dir_all(&dir).unwrap();}@@ -4870,9 +4880,34 @@ fn a_picture_of_the_editor() {if let Ok(brush) = std::env::var("KLAD_PICTURE_BRUSH") {ed.pick(&brush);}+ let numbers = |name: &str| -> Option<Vec<f32>> {+ let text = std::env::var(name).ok()?;+ text.split(',').map(|n| n.trim().parse().ok()).collect()+ };+ if let Some(view) = ed.view.as_mut() {+ if let Some(&[zoom]) = numbers("KLAD_PICTURE_ZOOM").as_deref() {+ view.zoom *= zoom;+ }+ if let Some(&[x, y]) = numbers("KLAD_PICTURE_CENTRE").as_deref() {+ view.center = vec2(x, y);+ }+ }Ok(())};- editor_picture(&std::fs::canonicalize(bundle).unwrap(), &layer, moment, Path::new(&out));+ let frames = std::env::var("KLAD_PICTURE_FRAMES").ok().map(|spec| {+ let (from, to) = spec.split_once('-').expect("KLAD_PICTURE_FRAMES is a range like 0-40");+ from.parse::<u32>().unwrap()..=to.parse::<u32>().unwrap()+ });+ let shots: Vec<(Option<u32>, PathBuf)> = match frames {+ None => vec![(None, PathBuf::from(&out))],+ Some(range) => {+ std::fs::create_dir_all(&out).unwrap();+ range+ .map(|frame| (Some(frame), Path::new(&out).join(format!("{frame:02}.png"))))+ .collect()+ }+ };+ editor_pictures(&std::fs::canonicalize(bundle).unwrap(), &layer, moment, &shots);}#[test]diff --git a/docs/images/creature-hero.gif b/docs/images/creature-hero.gifnew file mode 100644index 0000000..86c5498Binary files /dev/null and b/docs/images/creature-hero.gif differdiff --git a/docs/images/creature-painting.gif b/docs/images/creature-painting.gifdeleted file mode 100644index 3ec9553..0000000Binary files a/docs/images/creature-painting.gif and /dev/null differdiff --git a/docs/images/creature-walk-build.gif b/docs/images/creature-walk-build.gifdeleted file mode 100644index bf13264..0000000Binary files a/docs/images/creature-walk-build.gif and /dev/null differ