mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-30 13:11:33 +00:00
.cargo
crates
examples
add
asm.js
char
closures
comments
console_log
dom
guide-supported-types-examples
hello_world
import_js
julia_set
src
styles
.gitignore
Cargo.toml
README.md
build.sh
index.html
index.js
package.json
webpack.config.js
math
no_modules
performance
smorgasboard
wasm-in-wasm
README.md
guide
releases
src
tests
.appveyor.yml
.eslintignore
.eslintrc
.gitattributes
.gitignore
.travis.yml
CHANGELOG.md
CONTRIBUTING.md
Cargo.toml
LICENSE-APACHE
LICENSE-MIT
README.md
package-lock.json
package.json
yarn.lock
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);
|
||
|
});
|