#myContainer {
width: 250px;
height: 250px;
position: relative;
background: #111111;
}
#myAnimation {
width: 30px;
height: 30px;
position: absolute;
background-color: #FF4884;
}
button{
background:#00FFCF;
width:45px;
height:45px;
border-radius:50px;
cursor:pointer;
border:black;
}
👍
😻
function myMove() {
var elem = document.getElementById
(“myAnimation”);
var pos = 0;
var id = setInterval(frame, 10);
function frame() {
if (pos == 220) {
clearInterval(id);
} else {
pos++;
elem.style.top = pos + ‘px’;
elem.style.left = pos + ‘px’;
}
}
}
function myMove() {
var elem = document.getElementById
(“myAnimation”);
var pos = 0;
var id = setInterval(frame, 10);
function frame() {
if (pos == 220) {
clearInterval(id);
} else {
pos++;
elem.style.top = pos +’px’;
elem.style.left = pos +’px’;
}
}
}