JSFiddle - React, Tailwind, and code Playground

JavaScript

function move(object, distance) {
	object.x = object.x + distance * Math.cos(object.rotation);
	object.y = object.y + distance * Math.sin(object.rotation);
}

var ship = {
	x: 10,
  y: 10,
  rotation: 270 * Math.PI / 180
};

var span = document.createElement("span");
span.innerHTML = "Start:<br />" + JSON.stringify(ship);
move(ship, 100);
span.innerHTML += "<br />Stop:<br />" + JSON.stringify(ship);
document.body.appendChild(span);