<div class="box"></div>
body {
background-color: #222;
margin: 0;
padding: 0;
overflow: hidden;
width: 100%;
height: 100%;
}
.box {
width: 200px;
height: 200px;
background-color: #88ce02;
margin: 50px auto;
}
var tl = gsap.timeline({
repeatRefresh: true,
repeat: -1,
repeatDelay: 0.3
});
tl.to(".box", {
duration: 1,
x: "random(-500, 500)",
backgroundColor: "hsl(+=random(-100, 100), 80%, 50%)",
});
This Pen doesn't use any external CSS resources.