Skip to content

Commit

Permalink
Update main.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
gastonmorixe authored Oct 24, 2024
1 parent 0dc2e4e commit 6d6831f
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { AnimationEngine } from "./engine";
import { MovementSystem, FrictionSystem } from "./systems";

// Specialized Systems and Entities
import { MouseForceSystem, DOMUpdateSystem, DOMMouseDragHandler } from "./dom";
import { MouseForceSystem, DOMUpdateSystem } from "./dom";
import { BoxEntity, AnchorEntity } from "./entities";
import { SpringEntity, SpringPhysicsSystem } from "./spring";
import { ChartSystem } from "./chart";
Expand All @@ -25,23 +25,20 @@ const anchorEntity = new AnchorEntity({ x: 100, y: 100 }, "anchor");

// Create a spring entity that connects box1 and anchor
const springEntity = new SpringEntity(boxEntity, anchorEntity, 0.2, 0.05, 1.0);
springEntity.name = "spring";

// Create second box entity
const boxElement2 = document.getElementById("box2") as HTMLElement;
const boxEntity2 = new BoxEntity(boxElement2, { x: 250, y: 100 }, "box2");

// Creating the spring force connecting box and box2
const springEntity2 = new SpringEntity(boxEntity, boxEntity2, 0.2, 0.05, 2.0);
springEntity2.name = "spring2";

// Create third box entity
const boxElement3 = document.getElementById("box3") as HTMLElement;
const boxEntity3 = new BoxEntity(boxElement3, { x: 400, y: 100 }, "box3");

// Creating the spring force connecting box2 and box3
const springEntity3 = new SpringEntity(boxEntity2, boxEntity3, 0.1, 0.05, 1.0);
springEntity3.name = "spring3";

//
// --- Systems ---
Expand Down Expand Up @@ -96,7 +93,7 @@ if (chartContext) {
engine.start();

// TODO
// -[ ] Prepare specific entities kinds (anchor, box, etc). The components should be added in the constructor like the spring, this minimizes the amount of components to add manually to an entity.
// -[x] Prepare specific entities kinds (anchor, box, etc). The components should be added in the constructor like the spring, this minimizes the amount of components to add manually to an entity.
// -[ ] Cleanup creation examples, it's easy to forget to add entities to the engine if not added right after creation.
// -[ ] Take initial and drop velocity into account
// -[ ] Attach multiple entities to the spring force. Make a cloth like simulation.
Expand Down

0 comments on commit 6d6831f

Please sign in to comment.