Adds code editing and shape generation
This commit is contained in:
parent
afa8f53dff
commit
1a01c47835
34 changed files with 1298 additions and 237 deletions
|
@ -1,47 +1,8 @@
|
|||
export default `// Basic nodes and globs
|
||||
export default `new Circle({
|
||||
point: [200, 200],
|
||||
})
|
||||
|
||||
const nodeA = new Node({
|
||||
x: -100,
|
||||
y: 0,
|
||||
});
|
||||
|
||||
const nodeB = new Node({
|
||||
x: 100,
|
||||
y: 0,
|
||||
});
|
||||
|
||||
const glob = new Glob({
|
||||
start: nodeA,
|
||||
end: nodeB,
|
||||
D: { x: 0, y: 60 },
|
||||
Dp: { x: 0, y: 90 },
|
||||
});
|
||||
|
||||
// Something more interesting...
|
||||
|
||||
const PI2 = Math.PI * 2,
|
||||
center = { x: 0, y: 0 },
|
||||
radius = 400;
|
||||
|
||||
let prev;
|
||||
|
||||
for (let i = 0; i < 21; i++) {
|
||||
const t = i * (PI2 / 20);
|
||||
|
||||
const node = new Node({
|
||||
x: center.x + radius * Math.sin(t),
|
||||
y: center.y + radius * Math.cos(t),
|
||||
});
|
||||
|
||||
if (prev !== undefined) {
|
||||
new Glob({
|
||||
start: prev,
|
||||
end: node,
|
||||
D: center,
|
||||
Dp: center,
|
||||
});
|
||||
}
|
||||
|
||||
prev = node;
|
||||
}
|
||||
new Rectangle({
|
||||
point: [400, 300],
|
||||
})
|
||||
`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue