【发布时间】:2018-01-13 21:32:09
【问题描述】:
我有以下 jupyter 笔记本单元格,fourd.js 和 r89dev.three.min.js 在与笔记本相同的目录中的 js 文件夹中:
%%html
<!doctype html>
<html>
<head>
<title>FourD.js Testbed</title>
<script src="js/r89dev.three.min.js"></script>
<script src="js/fourd.js"></script>
</head>
<body>
<div id="display"></div>
<script>
var CIRCLES = 100;
var CIRCLE_SIZE = 10;
fourd = new FourD();
fourd.init('#display', {width: 500, height: 350});
fourd._internals.camera.position.set(0, 0, -50);
var vertex1 = fourd.graph.add_vertex({size: 10, color: 0x000000});
var vertex2 = fourd.graph.add_vertex({size: 10, color: 0x000000});
var edge = fourd.graph.add_edge(vertex1, vertex2);
for(var i=0; i<CIRCLES; i++){
vertex_options = [];
for(var j=0; j<CIRCLE_SIZE; j++){
vertex_options.push({size: 10, color: 0x000000});
}
fourd.graph.add_cycle(vertex_options);
}
</script>
</body>
</html>
我第一次尝试时它有效,但现在我收到一个错误,即未定义 THREE。这意味着它正在加载fourd.js 库,而不是three.js 库。我可能会错过什么?
我在笔记本中直接得到的错误如下:
Javascript error adding output!
ReferenceError: THREE is not defined
See your browser Javascript console for more details.
但是我在javascript控制台中找不到关于三个js未加载的相应错误消息。
【问题讨论】:
标签: javascript html jupyter-notebook jupyter