Created
February 2, 2016 23:19
-
-
Save kirjavascript/3f3d8f4be35ffc6eaee7 to your computer and use it in GitHub Desktop.
x3dom test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"/> | |
<title>X3DOM page</title> | |
<script type='text/javascript' src='http://www.x3dom.org/download/x3dom.js'> </script> | |
<script src="https://d3js.org/d3.v3.min.js"></script> | |
</head> | |
<body> | |
<x3d width='500px' height='400px'> | |
</x3d> | |
</body> | |
<script> | |
var scene = d3.select("x3d") | |
.append("scene") | |
var box = scene.append("shape") | |
box | |
.append("appearance") | |
.append("material") | |
.attr("diffuseColor","1 0 0") | |
box | |
.append("box") | |
d3.select("shape") | |
.attr("onclick", "clrwarp()") | |
function clrwarp() { | |
d3.select("material") | |
.transition() | |
.duration(1000) | |
.attr("diffuseColor",`${Math.random()} ${Math.random()} ${Math.random()}`) | |
} | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment