1
0
mirror of https://github.com/taigrr/wasm-experiments synced 2025-01-18 04:03:21 -08:00

Add canvas animation demo

This commit is contained in:
Johan Brandhorst
2019-06-09 20:09:50 +01:00
parent b8bf9995ca
commit 7d59825716
5 changed files with 540 additions and 9 deletions

View File

@@ -6,13 +6,11 @@ hello: clean
.PHONY: tinygo
tinygo: clean
#docker run --rm -v $$(pwd):/go/src/github.com/johanbrandhorst/wasm-experiments tinygo/tinygo:0.5.0 /bin/bash -c "\
# cd /go/src/github.com/johanbrandhorst/wasm-experiments && \
# tinygo build -o ./html/test.wasm -target wasm --no-debug ./$(target)/main.go && \
# cp /usr/local/tinygo/targets/wasm_exec.js ./html/wasm_exec.js\
#"
tinygo build -o ./html/test.wasm -target wasm --no-debug ./$(target)/main.go
cp ~/go/src/github.com/tinygo-org/tinygo/targets/wasm_exec.js ./html/wasm_exec.js
docker run --rm -v $$(pwd):/go/src/github.com/johanbrandhorst/wasm-experiments tinygo/tinygo:0.6.1 /bin/bash -c "\
cd /go/src/github.com/johanbrandhorst/wasm-experiments && \
tinygo build -o ./html/test.wasm -target wasm --no-debug ./$(target)/main.go && \
cp /usr/local/tinygo/targets/wasm_exec.js ./html/wasm_exec.js\
"
cp $$(go env GOROOT)/misc/wasm/wasm_exec.html ./html/index.html
sed -i -e 's;</button>;</button>\n\t<div id=\"target\"></div>;' ./html/index.html
@@ -36,6 +34,22 @@ fetch: clean
cp $$(go env GOROOT)/misc/wasm/wasm_exec.js ./html/wasm_exec.js
sed -i -e 's;</button>;</button>\n\t<div id=\"target\"></div>;' ./html/index.html
.PHONY: canvas
canvas: clean
GOOS=js GOARCH=wasm go build -o ./html/test.wasm ./canvas/main.go
cp ./canvas/index.html ./html/index.html
cp ./canvas/main.go ./html/main.go
cp $$(go env GOROOT)/misc/wasm/wasm_exec.js ./html/wasm_exec.js
tinygo-canvas: clean
docker run --rm -v $$(pwd):/go/src/github.com/johanbrandhorst/wasm-experiments tinygo/tinygo:0.6.1 /bin/bash -c "\
cd /go/src/github.com/johanbrandhorst/wasm-experiments && \
tinygo build -o ./html/test.wasm -target wasm --no-debug ./canvas/main.go && \
cp /usr/local/tinygo/targets/wasm_exec.js ./html/wasm_exec.js\
"
cp ./canvas/index.html ./html/index.html
cp ./canvas/main.go ./html/main.go
test: clean
GOOS=js GOARCH=wasm go test -c -o ./html/test.wasm ./test/