title: javascript animation using two pictures
body: <p>I am programming animation in Javascript and got stuck. The idea is, that two pictures of diamond switch so that user see the diamond that shine. Here is my code:</p>
  
  <pre><code>import IMovingObject from '../interface/IMovingObject'
  import AssetLoader from '../utils/AssetLoader'
  
  export default class Diamond extends IMovingObject {
      constructor (game, x, y){
          super (game, x, y)
          this.currentAnimationState = 0
          const spriteWidth = 32
          this.animationSprites = [
              { x: 0 * spriteWidth, y: 0 * spriteWidth }
          ]
          this.FrameCount = 0
          this.fps = 30
      } 
  
      handleCollisionWith(obj, direction, impact) {
          this.game.post('collected', this)
          this.emit('remove', this)
  
          return true
      }
  
      draw() {
          this.game.engine.drawImage(
              this.game.assets.diamond1,
              256,
              256,
              0,
              0,
              this.x,
              this.y,
              this.width
          ) // Diamond
  
      }
      update(){
          this.currentAnimationState =
              (this.currentAnimationState % this.FrameCount === 0)    
      } 
  
  }
  export const isDiamond = obj =&gt; obj instanceof Diamond
  </code></pre>
  
  <p>Do anyone know what I should change on he code so that it works?</p>