zemfira2108,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
div{
height: 100px;
width: 100px;
background-color: #FF00FF;
border-radius: 50%;
transition: 1.2s;
transform: translate();
}
</style>
<script>
addEventListener('DOMContentLoaded', function() {
const elem = document.querySelector('div'),
size = [innerWidth - 100, innerHeight - 100],
random = a => a * Math.random()|0,
timer = () => {
const [left, top] = size.map(random);
elem.style.transform = `translate(${left}px, ${top}px`;
setTimeout(timer, 1200)
};
timer()
});
</script>
</head>
<body>
<div></div>
</body>
</html>