copied transition from chess game.js