Skip to content

Commit 71a5733

Browse files
committed
adding html rendering example
1 parent 23e73bd commit 71a5733

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

‎examples/01_HTML/index.html‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<html>
2+
<head>
3+
<script src="../aframe.js"></script>
4+
<script src="../../index.js"></script>
5+
<script src="https://cdnjs.cloudflare.com/ajax/libs/rasterizehtml/1.2.2/rasterizeHTML.allinone.js"></script>
6+
</head>
7+
<body>
8+
<a-scene>
9+
<a-sky color="#6EBAA7"></a-sky>
10+
<a-plane id="screen" position="0 1.25 -1" color="red" scale="3 3 3" canvas-2d="width:500;height:500"/>
11+
</a-scene>
12+
<iframe id="ui"></iframe>
13+
</body>
14+
<script>
15+
var ctx = document.querySelector("#screen").getContext("2d")
16+
document.getElementById('ui').contentWindow.document.body.innerHTML = 'Hello Frame!<button style="position:absolute;left:100px;top:100px">Hey!</button>'
17+
rasterizeHTML.drawDocument(document.getElementById('ui').contentWindow.document, ctx.canvas, {width: 500}).then(function success(renderResult) {
18+
ctx.update();
19+
}, function error(e) {
20+
console.log(e)
21+
});
22+
</script>
23+
</html>

0 commit comments

Comments
 (0)