JSFiddle - React, Tailwind, and code Playground

by Chandana Thota

HTML

<div></div>

CSS

div {
    width:50px;
    height:50px;
    background-color: red;
    position: absolute;
    top: 100px;
    left: 200px;
}

JavaScript

$(function() {
        var dist = 30;
        var angle = 48;
        var x = Math.cos(angle*Math.PI/180) * dist;
        var y = Math.sin(angle*Math.PI/180) * dist;
        $("div").animate({'left': '+='+x+'px', 'top': '+='+y+'px'}, 1000);      
    })