Home

Awesome

waPC + Mandelbrot example

Adaptation of https://www.assemblyscript.org/examples/mandelbrot.html for waPC.

Renders the Mandelbrot set to a canvas using 2048 discrete color values computed on the JS side.

Contents:

Note: js/mandelbrot.js loads the AssemblyScript module, but you can change it to test the other language's modules.

Building:

This depends on having the waPC CLI installed.

make

This installs dependencies, runs the wapc generate command to generate the biolerplate code from schema.widl, and compiles the AssemblyScript module.

Running:

You can start an HTTP server from this directory (so long as .wasm files are served with a Content-Type of application/wasm). If you have node installed you can run the following command to start a simple static server.

node server.js

Then point your browswer to http://localhost:8888.

Finally, to demonstrate the portability of waPC modules, you can run a simple Go program to export the rendered image to a png.

make png