Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to WebGL #49

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
![](res/demo.png)

## ⚙️Features
- ⚡️Real-time auto 🔆light/🌙dark theme switching, with _transitioning_ ✨️
- ⚡️Efficient: GPU-accelerated rendering (WIP)
- 👆Interactive: droplet spawning on 🖱click/touch
- Real-time auto 🔆light/🌙dark theme switching, with _transitioning_ ✨️
- 💻Responsive: efficient resizing, and native full-screen resolution

## ℹUsage
You can [go to the website](https://Rudxain.github.io/RGB-digital-rain) (minified), or [⬇download](https://github.com/Rudxain/RGB-digital-rain/archive/refs/heads/main.zip) this branch (cutting-edge). If you downloaded the branch, then extract it, then open `src/index.html` on any 🌐browser.
This `gl` branch is for switching to `WebGL` API. Code will be broken while I rewrite it.

## Naming?
If you don't believe me, the "official" name is ["Digital Rain"](https://en.wikipedia.org/wiki/Matrix_digital_rain), even though the standard-de-facto is "falling code".
Expand Down
3 changes: 3 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,16 @@
And set font-size accordingly
*/
const resize = () => {
// to-do: detect if the final dimensions

Check failure

Code scanning / ESLint

Disallow specified warning terms in comments Error

Unexpected 'to-do' comment: 'to-do: detect if the final dimensions'.
// are actually diff
const { clientWidth, clientHeight } = body
canv.style.width = clientWidth + "px"
canv.style.height = clientHeight + "px"
const scale = devicePixelRatio
const save = ctx.getImageData(0, 0, w, h)
w = canv.width = clientWidth * scale >>> 0
h = canv.height = clientHeight * scale >>> 0
// to-do: call only if the canvas grows AND is white

Check failure

Code scanning / ESLint

Disallow specified warning terms in comments Error

Unexpected 'to-do' comment: 'to-do: call only if the canvas grows AND...'.
ctx_fillFull(anim.settings.dim_factor < 0 ? "fff" : "000")
ctx.putImageData(save, 0, 0)
//ctx.scale(scale, scale) // is normalization necessary?
Expand Down
Loading