Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
22
Task/Mandelbrot-set/JavaScript/mandelbrot-set-2.js
Normal file
22
Task/Mandelbrot-set/JavaScript/mandelbrot-set-2.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
var mandelIter;
|
||||
fetch("./mandelIter.wasm")
|
||||
.then(res => {
|
||||
if (res.ok) return res.arrayBuffer();
|
||||
throw new Error('Unable to fetch WASM.');
|
||||
})
|
||||
.then(bytes => { return WebAssembly.compile(bytes); })
|
||||
.then(module => { return WebAssembly.instantiate(module); })
|
||||
.then(instance => { WebAssembly.instance = instance; draw(); })
|
||||
|
||||
function mandelbrot(canvas, xmin, xmax, ymin, ymax, iterations) {
|
||||
// ...
|
||||
var i = WebAssembly.instance.exports.mandelIter(x, y, iterations);
|
||||
// ...
|
||||
}
|
||||
|
||||
function draw() {
|
||||
// canvas initialization if necessary
|
||||
// ...
|
||||
mandelbrot(canvas, -2, 1, -1, 1, 1000);
|
||||
// ...
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue