-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
66 lines (48 loc) · 1.32 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html lang="en">
<head>
<title>nodular</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="test.css">
<link rel="icon" href="n.svg">
</head>
<style>
</style>
<body>
<div id="canvas">
</div>
</body>
<!-- <script src="fastdom.js"></script> -->
<script src="nodular.js"></script>
<script>
var editor = new Editor("canvas");
var n1 = new InNode("IN A");
var n2 = new Node("A + B");
var n3 = new InNode("IN B");
var n4 = new Node("OUT C");
editor.addNode(n1);
editor.addNode(n2);
editor.addNode(n3);
editor.addNode(n4);
n1.moveTo(200, 150);
n2.moveTo(550, 300);
n3.moveTo(200, 350);
n4.moveTo(900, 350);
n1.addOutput();
n2.addInput("ADD");
n2.addOutput("OUT");
n2.addInput("ADD");
n4.addInput("IN");
n3.addOutput();
n1.setFunc(function () { return 5; });
n3.setFunc(function () { return 3; });
n2.setFunc(function (a, b) { return (a + b); });
n4.setFunc(function (c) { console.log(c); });
editor.connect(n1.outputs[0], n2.inputs[0]);
editor.connect(n3.outputs[0], n2.inputs[1]);
editor.connect(n2.outputs[0], n4.inputs[0]);
// function lineFeed(e) {
// document.getElementsByClassName("linec")[0].innerHTML = Array.from(Array(document.getElementsByClassName("idecode")[0].value.split("\n").length)).map((e, i) => i + 1).join("<br>");
// }
</script>
</html>