<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0">
<title>setTimeout Test</title>
<style type="text/css">
html, body {
height: 100%;
padding: 0px;
margin: 0px;
}
#container {
width: 100%;
height: 100%;
background: rgb(128, 128, 128);
}
</style>
</head>
<body>
<div id="container"></div>
<script type="text/javascript">
var container = document.getElementById('container');
var c = 128;
tick();
function tick() {
++c;
c %= 256;
container.style.backgroundColor = "rgb("+c+","+c+","+c+")";
setTimeout(tick, 16.66666);
};
</script>
</body>
</html>