Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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