Remix.run Logo
kingstnap 2 days ago

The math isn't that bad if anyone wants to do it properly.

Assume y vertical and x horizontal and z out of the page.

The moon is a disk. x^2 + y^2 <= R^2

For all the points, calculate z = sqrt(R^2 - y^2 - x^2)

Let the vector v(theta) = <sin(theta), 0, cos(theta)> point to the Sun.

Points <x,y,z> • v(theta) >= 0 should be bright, The rest dim.

JdeBP 2 days ago | parent [-]

Now achieve that when your implementation constraint is that you're using JavaScript to style a <div/> element. (-:

* https://github.com/Sean-93/asciimoon/blob/main/src/component...