Runtime image manipulation

this is an experiment with changing the pixels of images while the game is running.
experiment-canvas.wick (48.0 KB)

in this project is a square that follows your mouse. and each pixel of the square changes colors depending on its position from the top left corner of the screen.

why i made this was because of an apparent lack of path/text clipping, i wondered if i could achieve clipping by directly manipulating the canvas. i probably wouldn’t be able to draw anything on the canvas context because it would redraw the scene after my script ran, nullifying my changes. but i found out that image object stores a canvas (containing the image) which gets drawn in the canvas when it’s time to render it, so by modifying that i can achieve what i desired.

super weird and laggy.html (2.1 MB)

(I’m probably not going to use this to make the health bar)

3 Likes

Wow, I didn’t know you could modify image objects!?!
I’ve gotta say, this is impressive!

Thanks for sharing!

1 Like