首页 > 解决方案 > 有没有办法在 jupyter 的 ijavascript 内核中运行threejs?

问题描述

我有一个建立在三个.js 之上的库,我想在 ijavascript (jupyter + ijavascript) 笔记本中运行它。有谁知道这是否可能?

据我所知,three.js 使用 require('three') 运行得很好,但我在附加渲染器时遇到了麻烦。

标签: three.jsjupyter-notebookjupyterjupyter-lab

解决方案


已经有一个成熟的解决方案,您可以使用 Jupyter-Widigts 以更 Pythonic 的方式进行编码。

pythreejs three.js 嵌入在一个 jupyter widgit 中

在笔记本中显示一个绿色球体。

ball = Mesh(geometry=SphereGeometry(radius=1), 
        material=MeshLambertMaterial(color='#00ff00'),
        position=[0, 0, 0]) 
ball

输出


推荐阅读