Basic animation


In the old engine, there was only the explosion as animation. It consisted of a few particles going in different directions for x amount of time. Now, I want to add animation to images which will change image every x amount of time. The similarities between to two type of animation is the speed between frames and the number of frames.

function AnimationInformation() {
    this.name = "";
    this.extraReference = null;
    this.parts = [];     this.startingTime = 0;
    this.lastProcessTime = 0;
    this.currentFrame = 0;
    this.maxFrames = 0;
    this.speed = 1000;
    this.stopOnEnd = false;     this.onFrameChange = null;
    this.onEnding = null;
}

This is what I will start with, it seems to be working well for my needs. Every time a new frame is executed, the onFrameChange will be called which just calls a custom animation function. I do store the lastProcessTime and currentFrame but this could easily be calculated based on the startingTime and the speed. And it seems to be working well for now.



Leave a comment

Log in with itch.io to leave a comment.