Skip to content

Instantly share code, notes, and snippets.

@kirjavascript
Created February 2, 2016 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirjavascript/3f3d8f4be35ffc6eaee7 to your computer and use it in GitHub Desktop.
Save kirjavascript/3f3d8f4be35ffc6eaee7 to your computer and use it in GitHub Desktop.
x3dom test
<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