(* Simple test to show exact escape sequences without data *) module K = Kgp let print_escaped s = String.iter (fun c -> let code = Char.code c in if code = 27 then print_string "\\x1b" else if code < 32 || code > 126 then Printf.printf "\\x%02x" code else print_char c ) s; print_newline () let () = let image_id = 300 in let width, height = 80, 80 in print_endline "=== Animation Escape Sequences (no data) ===\n"; (* 1. Transmit base frame (no data for testing) *) print_endline "1. Transmit (a=t):"; let cmd1 = K.Command.transmit ~image_id ~format:`Rgba32 ~width ~height ~quiet:`Errors_only () in print_escaped (K.Command.to_string cmd1 ~data:""); (* 2. Frame command *) print_endline "\n2. Frame (a=f):"; let cmd2 = K.Command.frame ~image_id ~format:`Rgba32 ~width ~height ~frame:(K.Frame.make ~gap_ms:100 ~composition:`Overwrite ()) ~quiet:`Errors_only () in print_escaped (K.Command.to_string cmd2 ~data:""); (* 3. Put/display command *) print_endline "\n3. Display/Put (a=p):"; let cmd3 = K.Command.display ~image_id ~placement:(K.Placement.make ~placement_id:1 ~cell_x_offset:0 ~cell_y_offset:0 ~cursor:`Static ()) ~quiet:`Errors_only () in print_escaped (K.Command.to_string cmd3 ~data:""); (* 4. Set root frame gap - IMPORTANT for animation! *) print_endline "\n4. Set root frame gap (a=a, r=1, z=100):"; let cmd4 = K.Command.animate ~image_id (K.Animation.set_gap ~frame:1 ~gap_ms:100) in print_escaped (K.Command.to_string cmd4 ~data:""); (* 5. Animate - start *) print_endline "\n5. Animate start (a=a, s=3, v=1):"; let cmd5 = K.Command.animate ~image_id (K.Animation.set_state ~loops:1 `Run) in print_escaped (K.Command.to_string cmd5 ~data:""); (* 6. Animate - stop *) print_endline "\n6. Animate stop (a=a, s=1):"; let cmd6 = K.Command.animate ~image_id (K.Animation.set_state `Stop) in print_escaped (K.Command.to_string cmd6 ~data:"")