controls a square in the canvas with the keys or the virtual keys