It's chemical. When you rip it open you're breaking chemical bonds in the glue which release the energy as light.