barrel
Version:
An abstract player for sequences of timed events.
34 lines • 715 B
HTML
<html>
<head>
<style>
body {
background: #111;
margin: 0;
}
div {
width: 100px;
height: 100px;
margin: 50px;
}
</style>
</head>
<body>
<div></div>
<script>
init = function(){
var ws = new WebSocket('ws://127.0.0.1:8080');
ws.onopen = function() {
ws.send('play!');
};
ws.onmessage = function(msg) {
d = JSON.parse(msg.data);
console.log(d);
s = 'hsl('+d.hue+','+d.saturation+'%,'+d.lightness+'%)';
document.getElementsByTagName('div')[0].style.background = s;
}
};
init();
</script>
</body>
</html>