A lens bends the light from the flame so that the rays meet again on the other side, and there they draw a picture of the candle. Upside down! Hold a sheet of paper there and you would see it glowing.
The source code is at github.com/KirillOsenkov/LiveGeometry. It is written in .NET and Avalonia.
Also here: Catriona Agg's geometry puzzles and puzzles from Geometry Snacks made interactive; the same gallery in plain JavaScript; and how to embed a live drawing in your own page.