How to animate a flame in JavaScript canvas: quadratic curve shapes, layered sine noise for flicker, spark particles, and a strike-to-burn state machine.