Small library for generating claude-code like unicde block mascots, and providing animations when they do stuff
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: extend leg span 1 col outside body on each side

Legs now distribute across width+2 columns (1 col overhang on each
side of the body), giving more space for higher leg counts.

+23 -26
+23 -26
src/main.rs
··· 56 56 format!("\x1b[38;2;{};{};{}m\u{2588}\x1b[0m", r, g, b) 57 57 } 58 58 59 - /// Build a leg row mask for the given body width and number of legs. 60 - /// Legs are distributed evenly across columns 1..(width-1) (one col inset from each edge). 61 - /// Each leg is 1 column wide. Returns a vec of bools (true = leg block). 62 - fn leg_mask(width: usize, numlegs: usize) -> Vec<bool> { 63 - let mut mask = vec![false; width]; 64 - if numlegs == 0 || width < 3 { 65 - return mask; 59 + /// Build a leg row mask. Legs span from 1 col outside the body on each side, 60 + /// giving a total span of width+2. Returns a vec of bools of that total width, 61 + /// where index 0 = 1 col left of body. Also returns the offset (1) so the 62 + /// caller knows how to align it. 63 + fn leg_mask(width: usize, numlegs: usize) -> (Vec<bool>, usize) { 64 + let overhang = 1usize; 65 + let total = width + 2 * overhang; 66 + let mut mask = vec![false; total]; 67 + if numlegs == 0 { 68 + return (mask, overhang); 66 69 } 67 70 68 - // Usable span: columns 1 through width-2 (inset 1 from each edge) 69 - let span_start = 1usize; 70 - let span_end = width - 2; // inclusive 71 - let span = span_end - span_start + 1; 71 + // Full span: 0 through total-1 72 + let span = total; 72 73 73 74 if numlegs == 1 { 74 - // Center it 75 - mask[width / 2] = true; 76 - return mask; 75 + mask[span / 2] = true; 76 + return (mask, overhang); 77 77 } 78 78 79 - // Distribute numlegs evenly across the span 79 + // Distribute numlegs evenly across the full span 80 80 for i in 0..numlegs { 81 - let col = if numlegs == 1 { 82 - span_start + span / 2 83 - } else { 84 - span_start + (i * (span - 1)) / (numlegs - 1) 85 - }; 86 - if col < width { 81 + let col = (i * (span - 1)) / (numlegs - 1); 82 + if col < total { 87 83 mask[col] = true; 88 84 } 89 85 } 90 86 91 - mask 87 + (mask, overhang) 92 88 } 93 89 94 90 fn main() { ··· 160 156 } 161 157 162 158 // -- Leg rows -- 163 - let legs = leg_mask(width, numlegs); 159 + let (legs, overhang) = leg_mask(width, numlegs); 164 160 let effective_legsize = if numlegs == 0 { 0 } else { legsize }; 165 161 166 162 for _row in 0..effective_legsize { 167 - // Left padding (arm area) 168 - for _ in 0..arm_pad { 163 + // Left padding: arm area minus overhang (legs can stick out 1 col past body) 164 + let leg_pad = if arm_pad >= overhang { arm_pad - overhang } else { 0 }; 165 + for _ in 0..leg_pad { 169 166 output.push_str(space); 170 167 } 171 - for col in 0..width { 168 + for col in 0..legs.len() { 172 169 if legs[col] { 173 170 output.push_str(&body_block); 174 171 } else {