Ok, got it, I think:
$ bash -c 'trap stopit SIGINT; stopit() { echo Done; exit; }; while [ $run1 ]; do for i in {0..4}; do v=$(($i*50)); d=$(for ((k=0;k<=(5+$i);k++)); do echo -n $(($v*(($k+$i)%2))),; done); d=${d%?}; c=$(echo numbers $d); echo $c; sleep 0.1; done; done ;'
numbers 0,0,0,0,0,0
numbers 50,0,50,0,50,0,50
numbers 0,100,0,100,0,100,0,100
numbers 150,0,150,0,150,0,150,0,150
numbers 0,200,0,200,0,200,0,200,0,200
numbers 0,0,0,0,0,0
numbers 50,0,50,0,50,0,50
numbers 0,100,0,100,0,100,0,100
numbers 150,0,150,0,150,0,150,0,150
numbers 0,200,0,200,0,200,0,200,0,200
numbers 0,0,0,0,0,0
Done
Basically, the concept with "changing a global variable to exit cleanly" will not work because variables in functions in bash are always local scope, and "shadow" the globals, see:
So after reading
... it turns out, its best to move the final command ("echo Done") in the trap handler, and after it, from the trap handler, issue exit directly (don't bother with the "exit the while loop cleanly to print afterwards" thing)