If you're asking about the ASCII alone then it's quite simple.
You resize the image to fit your text area dimension, then probe each pixel for luminance, and based on how bright the pixel is, you swap it for a ascii character that takes more or less space.
If you're asking about animation it's called color cycling and was quite popular back in the days where there was no space to pack a real animations: https://www.effectgames.com/demos/canvascycle/?sound=0