All Projects → ColinEberhardt → D3 Wasm Force

ColinEberhardt / D3 Wasm Force

A re-implementation of d3-force with WebAssembly.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to D3 Wasm Force

Emscripten Docker
Docker image with Emscripten to compile ASM.js and WebAssembly
Stars: ✭ 92 (-1.08%)
Mutual labels:  webassembly, wasm
Wasmer
🚀 The leading WebAssembly Runtime supporting WASI and Emscripten
Stars: ✭ 11,047 (+11778.49%)
Mutual labels:  webassembly, wasm
React Vim Wasm
Vim editor embedded in your React web application
Stars: ✭ 77 (-17.2%)
Mutual labels:  webassembly, wasm
Wagi
Write HTTP handlers in WebAssembly with a minimal amount of work
Stars: ✭ 75 (-19.35%)
Mutual labels:  webassembly, wasm
Draw App
In browser drawing app built in rust / wasm
Stars: ✭ 87 (-6.45%)
Mutual labels:  webassembly, wasm
Pulsefft
A WebAssembly implementation of the C Fast Fourier Transform library kissFFT
Stars: ✭ 76 (-18.28%)
Mutual labels:  webassembly, wasm
Dcmjs
dcmjs is a javascript cross-compile of dcmtk (dcmtk.org).
Stars: ✭ 92 (-1.08%)
Mutual labels:  webassembly, wasm
Dockerdot
🐳 dockerdot shows dockerfile dependenciy graph. This is useful to understand how build dockerfile. This uses Go WebAssembly + BuildKit package.
Stars: ✭ 65 (-30.11%)
Mutual labels:  webassembly, wasm
Wasm To Oci
Use OCI registries to distribute WASM modules
Stars: ✭ 83 (-10.75%)
Mutual labels:  webassembly, wasm
Denoflate
WebAssembly powered Deflate/Gzip/Zlib compression for Deno, written in Rust
Stars: ✭ 80 (-13.98%)
Mutual labels:  webassembly, wasm
Veracruz
Main repository for the Veracruz privacy-preserving compute project.
Stars: ✭ 71 (-23.66%)
Mutual labels:  webassembly, wasm
Wasm Forth
A Forth implementation compiling to WebAssembly.
Stars: ✭ 92 (-1.08%)
Mutual labels:  webassembly, wasm
Web Audio Javascript Webassembly Sdk Interactive Audio
🌐 Superpowered Web Audio JavaScript and WebAssembly SDK for modern web browsers. Allows developers to implement low-latency interactive audio features into web sites and web apps with a friendly Javascript API. https://superpowered.com
Stars: ✭ 68 (-26.88%)
Mutual labels:  webassembly, wasm
Fastq.bio
An interactive web tool for quality control of DNA sequencing data
Stars: ✭ 76 (-18.28%)
Mutual labels:  webassembly, wasm
Muze
Composable data visualisation library for web with a data-first approach now powered by WebAssembly
Stars: ✭ 1,153 (+1139.78%)
Mutual labels:  webassembly, wasm
Doomfire
DOOM fire implementation written in rust
Stars: ✭ 80 (-13.98%)
Mutual labels:  webassembly, wasm
Disable Webassembly
Browser hacks to disable WebAssembly (WASM)
Stars: ✭ 63 (-32.26%)
Mutual labels:  webassembly, wasm
Wasmer Python
🐍🕸 WebAssembly runtime for Python
Stars: ✭ 1,131 (+1116.13%)
Mutual labels:  webassembly, wasm
Opus Stream Decoder
Instantly decode Ogg Opus audio streams in chunks with JavaScript & WebAssembly (Wasm)
Stars: ✭ 80 (-13.98%)
Mutual labels:  webassembly, wasm
Web Dsp
A client-side signal processing library utilizing the power of WebAssembly (.wasm)
Stars: ✭ 1,278 (+1274.19%)
Mutual labels:  webassembly, wasm

d3-wasm-force

A re-implementation of d3-force in WebAssembly with the AssemblyScript compiler. Read more about the project in the accompanying blog post, and see the code in action in this bl.ock.

Overview

The goal of this project is to create a drop-in replacement for d3-force, using WebAssembly. Rather than implement the full d3-force API, I am aiming to re-create the following example:

https://bl.ocks.org/mbostock/4062045

To build the project run:

npm install
npm run build

This will run the TypeScript compiler and rollup to create a bundle, and the AssemblyScript compiler to create a separate wasm file.

The resulting output is namespaces as d3wasm, and can be used in exactly the same way as the d3 counterpart:

const simulation = d3wasm.forceSimulation(graph.nodes, true)
  .force('charge', d3wasm.forceManyBody())
  .force('center', d3wasm.forceCenter(width / 2, height / 2))
  .force('link', d3wasm.forceLink().links(graph.links).id(d => d.id))
  .stop();

Switching between WebAssembly and JavaScript

One of the really interesting features of AssemblyScript is that it compiles TypeScript to JavaScript. As a result, the TypeScript source of the WebAssembly module can also be compiled to TypeScript, giving the option of running it either as WebAssembly or JavaScript!

The second argument passed to forceSimulation allows you to choose whether to use the WebAssembly or JavaScript build. Passing false uses the JavaScript version:

const simulation = d3wasm.forceSimulation(graph.nodes, false)

TODO

  • [x] Create multiple typescript configurations
  • [x] Inline the code (note, could use rollup-plugin-wasm), although inline code is still async
  • [x] Resolve build-wasm warnings
  • [x] Find a better way to read / write WASM buffers
  • [ ] Make use of d3-force typing
  • [x] ensure the code behaves exactly the same as d3-force
  • [x] implement the fx / fy properties of force layout
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].