Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="iso-8859-1">
- <<title>Getting Started with Three.js -- Brython version</title>
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/brython@3.8.9/brython.min.js">
- </script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/100/three.min.js"></script>
- <script type="text/python">
- from browser import document, window
- THREE = window.THREE
- camera = THREE.PerspectiveCamera.new(75, 1, 1, 10000)
- camera.position.z = 1000
- scene = THREE.Scene.new()
- geometry = THREE.CubeGeometry.new(200, 200, 200)
- material = THREE.MeshBasicMaterial.new({"color": "#ff0000", "wireframe": True})
- mesh = THREE.Mesh.new(geometry, material)
- scene.add(mesh)
- renderer = THREE.WebGLRenderer.new()
- renderer.setSize(444, 444)
- document <= renderer.domElement
- renderer.render(scene, camera)
- def animate(i):
- # note: three.js includes requestAnimationFrame shim
- window.requestAnimationFrame(animate)
- mesh.rotation.x += 0.01
- mesh.rotation.y += 0.02
- renderer.render(scene, camera)
- animate(0)
- </script>
- </head>
- <body onload="brython(1)">
- <div id="test"></div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment