mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-20 00:27:26 +03:00
a5b8c45d28
* adds julia set example * fixes indentation in *.js files * fixes *.js formatting * fixes a typo in function arguments signature
18 lines
656 B
JavaScript
18 lines
656 B
JavaScript
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);
|
|
});
|