-
Notifications
You must be signed in to change notification settings - Fork 0
/
random-color.xml
31 lines (27 loc) · 900 Bytes
/
random-color.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<scene>
<spawn position="0 0 10" />
<box id="home" color="#ff00aa" position='-3 1.5 0' scale="3 3 3" />
<box id="two" color="#0033aa" position='3 1.5 0' scale="3 3 3" />
<skybox style="color: linear-gradient(#fff, #acf)" />
<billboard position="0 1 0">
<![CDATA[
<center style="padding: 40px; font-size: 2em">
This is a simple demo that shows how you can change the color
of a box.
</center>
]]>
</billboard>
<script>
function randomColor(){
return (0x100000 + ~~(Math.random() * 0xEFFFFF)).toString(16);
}
document.addEventListener("ready", function(event) {
setInterval(function(){
document.getElementById("home").style.color = '#' + randomColor();
}, 800);
setInterval(function(){
document.getElementById("two").style.color = '#' + randomColor();
}, 1000);
});
</script>
</scene>