Build a chart one block at a time
Install
npm install -g @lmctl-ai/lmctl
lmvideo 0.1.38 is released. Source examples are pinned to public commit aab2677.
The bars have weight: each colored unit can fall and collide. Motion is replayed through a smooth periodic phase to form the loop.
Run this example
lmctl autorun https://raw.githubusercontent.com/lmctl-ai/lmvideo/aab2677a4b6264ae6afae8ad64a1d7c1dcd3a052/examples/physics/bar-stack.lms
Source
mkdir("build/physics");
program=_lmcode_ cli="lmvideo" install="github:lmctl-ai/lmvideo@v0.1.38";
let p=physics_presentation(512,384,20261103).title("BUILD SHIP",80.0,60.0,"#ef91b1").bar("BUILD",8.0,10.0,110.0,280.0,"#79c7c0").bar("SHIP",5.0,10.0,300.0,280.0,"#9fa5dc");let cache=timeline_create(512,384);
for(i in range(0,180)){cache.add(p.render(),1);p.step(1);}
video.size(512,384);video.fps(24);video.frames(96);video.output("build/physics/bar-stack.mp4");video.begin();
for(f in range(0,video.count())){video.frame();let q=sin(3.1415926535*float(f)/96.0);let im=cache.frame(int(q*q*179.0+0.5));canvas.clear("#101827");canvas.image(im,0.0,0.0);canvas.text("time-replayed physics",16.0,28.0,font(15.0),paint().color("#fff1d6"));if(f==32){video.save_frame("build/physics/bar-stack.png");}}
video.end();
end _lmcode_
r=run_lmcode(program);assert(r.ok,(r.ok ? "" : r.message));