mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-22 17:21:35 +00:00
adds julia set example (#419)
* adds julia set example * fixes indentation in *.js files * fixes *.js formatting * fixes a typo in function arguments signature
This commit is contained in:
committed by
Alex Crichton
parent
b66095bcff
commit
a5b8c45d28
17
examples/julia_set/index.js
Normal file
17
examples/julia_set/index.js
Normal file
@ -0,0 +1,17 @@
|
||||
import('./julia_set')
|
||||
.then(wasm => {
|
||||
const canvas = document.getElementById('drawing');
|
||||
const ctx = canvas.getContext('2d');
|
||||
|
||||
const realInput = document.getElementById('real');
|
||||
const imaginaryInput = document.getElementById('imaginary');
|
||||
const renderBtn = document.getElementById('render');
|
||||
|
||||
renderBtn.addEventListener('click', () => {
|
||||
const real = parseFloat(realInput.value) || 0;
|
||||
const imaginary = parseFloat(imaginaryInput.value) || 0;
|
||||
wasm.draw(ctx, 600, 600, real, imaginary);
|
||||
});
|
||||
|
||||
wasm.draw(ctx, 600, 600, -0.15, 0.65);
|
||||
});
|
Reference in New Issue
Block a user