Updated transparency and did minor fix

This commit is contained in:
AtHeartEngineer
2023-04-13 13:38:32 +09:00
parent 06de9fc0dc
commit 05dfbaaddc
10 changed files with 23 additions and 292 deletions

View File

@@ -1,6 +1,6 @@
# Learning Rust Wasm
Converting some of my [javascript code](bg.js) that makes an animated background on a canvas to Rust Wasm, mainly for learning purposes.
[![pages-build-deployment](https://github.com/AtHeartEngineer/Animated_Background/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/AtHeartEngineer/Animated_Background/actions/workflows/pages/pages-build-deployment)
Converting some of my [javascript code](./bg.js) that makes an animated background on a canvas to Rust Wasm, mainly for learning purposes.
## Install Dependencies
@@ -8,7 +8,7 @@ Converting some of my [javascript code](bg.js) that makes an animated background
`cargo install wasm-pack`
## Build
`wasm-pack build`
`npm run build`
## Dev

2
bootstrap.js vendored
View File

@@ -1,4 +1,4 @@
import * as wasm from "./pkg/index_bg.wasm";
import * as wasm from "./docs/index_bg.wasm";
const DRAW_FPS = false;
wasm.init_panic_hook();

2
docs/.gitignore vendored
View File

@@ -1 +1 @@
*

View File

@@ -1,6 +1,6 @@
# Learning Rust Wasm
Converting some of my [javascript code](bg.js) that makes an animated background on a canvas to Rust Wasm, mainly for learning purposes.
[![pages-build-deployment](https://github.com/AtHeartEngineer/Animated_Background/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/AtHeartEngineer/Animated_Background/actions/workflows/pages/pages-build-deployment)
Converting some of my [javascript code](./bg.js) that makes an animated background on a canvas to Rust Wasm, mainly for learning purposes.
## Install Dependencies
@@ -8,7 +8,7 @@ Converting some of my [javascript code](bg.js) that makes an animated background
`cargo install wasm-pack`
## Build
`wasm-pack build`
`npm run build`
## Dev

File diff suppressed because one or more lines are too long

View File

@@ -419,8 +419,6 @@ export function __wbg_global_ba75c50d1cf384f4() { return handleError(function ()
return addHeapObject(ret);
}, arguments) };
export const __wbg_random_656f2ae924b2540e = typeof Math.random == 'function' ? Math.random : notDefined('Math.random');
export function __wbindgen_is_undefined(arg0) {
const ret = getObject(arg0) === undefined;
_assertBoolean(ret);
@@ -436,6 +434,8 @@ export function __wbindgen_object_drop_ref(arg0) {
takeObject(arg0);
};
export const __wbg_random_656f2ae924b2540e = typeof Math.random == 'function' ? Math.random : notDefined('Math.random');
export function __wbg_error_f851667af71bcfc6() { return logError(function (arg0, arg1) {
try {
console.error(getStringFromWasm0(arg0, arg1));

Binary file not shown.

View File

@@ -18,5 +18,8 @@
],
"module": "index.js",
"types": "index.d.ts",
"sideEffects": false
"sideEffects": [
"./index.js",
"./snippets/*"
]
}

2
package-lock.json generated
View File

@@ -1,5 +1,5 @@
{
"name": "animated-background",
"name": "Animated_Background",
"lockfileVersion": 2,
"requires": true,
"packages": {

View File

@@ -5,8 +5,8 @@ extern crate console_error_panic_hook;
const DENSITY: usize = 100; // lower = more dense
const MAX_SIZE: usize = 2;
const MIN_TRANSPARENCY: usize = 10;
const MAX_TRANSPARENCY: usize = 60;
const MIN_TRANSPARENCY: usize = 50;
const MAX_TRANSPARENCY: usize = 95;
const START_ANGLE: f64 = 4.18; // 240 degrees
const END_ANGLE: f64 = 5.24; // 300 degrees
const MAX_SPEED: usize = 2;