DEV Community

Franklin-hyriol
Franklin-hyriol

Posted on

๐Ÿš€ Modernizing Verlet.js with TypeScript and React Wrapper

๐ŸŒฑ Context

While working on my Spider Solitaire game in React (play it here ๐Ÿ•ท๏ธ๐ŸŽฎ), I had an idea for the โ€œarcade menuโ€: representing a dynamic spider web ๐Ÿ•ธ๏ธ where a spider moves around and eats insects ๐Ÿ›. Each insect would represent a game level.

The goal was to create a living, interactive menu instead of a simple static level list.

๐Ÿ” The Discovery

While looking for a way to simulate this, I stumbled upon this project: subprotocol.com/system/spider.html.

It was exactly what I had in mind ๐Ÿคฏ!

But after checking the GitHub repo, I quickly noticed some issues:

  • The last update was in 2013 (almost 12 years ago!)
  • The code is interesting but not compatible with modern JavaScript syntax
  • No integration with React or TypeScript

๐Ÿ› ๏ธ The Decision

Instead of reinventing the wheel, I decided to fork the Verlet.js project and:

  • Update the codebase to modern JavaScript
  • Add TypeScript support
  • Create a React wrapper so React developers can easily integrate Verlet.js into their projects

๐Ÿ“ฆ The Project Today

๐Ÿ‘‰ GitHub repo: https://github.com/Franklin-hyriol/verletjs

๐Ÿ‘‰ Available on npm:

npm install verlet-react verlet-engine
Enter fullscreen mode Exit fullscreen mode

๐Ÿš€ You can try it out right now!

โš ๏ธ For now, this is version 1.0:

  • No new features have been added yet
  • Itโ€™s simply the original library updated with TypeScript and React support

๐Ÿ“š Documentation is still in progress, so not fully available yet โ€” but itโ€™s coming soon!

๐Ÿ”ฎ Next Steps

Planned improvements include:

  • Adding more objects
  • Collision handling
  • Gravity
  • Wind and other physics interactions
  • And much moreโ€ฆ

๐Ÿค Contributions

All contributions are welcome ๐Ÿ™Œ

Whether itโ€™s adding new features, improving the code, or helping with docs, feel free to open an issue or a PR.

Top comments (0)