concept explosion in category javascript
appears as: explosions, explosion, n explosion, Explosion

This is an excerpt from Manning's book Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond.
2 You want the explosion to grow in size on every frame.
4 You want the explosion to fade in as it reaches its end size. 5 Once the explosion has reached its final size, remove it. There isn’t a lot new going on here. This is similar to the Comet class in the sense that you’re setting default options and using a dynamic shape. But you change the shape of the explosion at every frame. You’re also changing the size and opacity. Once the size of the explosion increases to its final size, you remove it.
Now you just need to create an explosion every time a rocket collides. Import the explosion class, as well as the getSpriteProperty helper, into the rocket module:
import { getSpriteProperty } from './framework/game'; import Explosion from './explosion';Now inside the Rocket class’s collision method, create an explosion: