04 - A fan of rays

The ring marks the source and follows the pointer. Drag it anywhere on the map.

cast(originX, originY, directionX, directionY, maxDistance, options)
Casts a single ray and returns the nearest object or tile that blocks it as a RayHit, or null if the ray reaches its full length without hitting anything.
The direction does not have to be a unit vector.

This is the only method the page uses. The fan is cast called four hundred times, once per angle, and the lit shape is the polygon its endpoints trace.