Move your cursor to change the shape of the triangle I have the resolution set to 8 so it won't lag at all on any device. (You can change it though) Settings: - resolution: The pen size used for the pixels - edgeculling: Don't draw the triangle if it isn't facing forwards (Mostly useful for 3D things) The colors are calculated using barycentric coordinates https://scratch.mit.edu/projects/1175127845/ You can change the "Fragment Shader" function to make colors appear differently.
It draws triangles with a unique (I think) approach by finding the left and right edge of the triangle and filling in all the pixels in between. I wrote this in JavaScript originally, then translated it by hand to lascra (my text-based Scratch programming language) The code in this project is compiled from the lascra code. JavaScript Version: https://editor.p5js.org/mts18142027/sketches/zg_0wmtb3 Lascra Version: https://github.com/bit-turtle/trianglerenderer/ You can try out lascra on my website: https://bit-turtle.github.io/lascra.html Also the pixels are not on a strict grid (It goes along with the left edge of the triangle)