How do I give this spaceship acceleration?
问题 Have a very small snippet of an asteroids-like game I'm working on using only the DOM without Canvas. I have the "ship" moving pretty smoothly when arrow keys are pressed but how would I go about making the ship accelerate ( in speed and rotation ) when an arrow key is held down for a longer length of time? window.onkeyup = function( e ) { var kc = e.keyCode; e.preventDefault(); if ( kc === 37 ) Keys.left = false; else if ( kc === 38 ) Keys.up = false; else if ( kc === 39 ) Keys.right = false