Skip to content

Commit

Permalink
Updated transparency and did minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AtHeartEngineer committed Apr 13, 2023
1 parent 06de9fc commit 05dfbaa
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 292 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# 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

`npm install`
`cargo install wasm-pack`

## Build

`wasm-pack build`
`npm run build`

## Dev
Expand Down
2 changes: 1 addition & 1 deletion bootstrap.js
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
2 changes: 1 addition & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@

*
6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# 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

`npm install`
`cargo install wasm-pack`

## Build

`wasm-pack build`
`npm run build`

## Dev
Expand Down
284 changes: 6 additions & 278 deletions docs/bundle.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/index_bg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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));
Expand Down
Binary file modified docs/index_bg.wasm
Binary file not shown.
5 changes: 4 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@
],
"module": "index.js",
"types": "index.d.ts",
"sideEffects": false
"sideEffects": [
"./index.js",
"./snippets/*"
]
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 05dfbaa

Please sign in to comment.