Created
June 7, 2025 22:09
-
-
Save Prozi/be7e5cbd1b0a2b54570003c170e4e8e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>PixiJS generative art</title> | |
<style> | |
body { | |
margin: 0; | |
overflow: hidden; | |
} | |
</style> | |
</head> | |
<body> | |
<!-- https://x.com/yuruyurau/status/1927373647125119025 --> | |
<script type="module"> | |
import * as PIXI from "https://esm.sh/pixi.js@^7"; | |
const app = new PIXI.Application({ | |
width: 400, | |
height: 400, | |
backgroundColor: 0x090909, | |
antialias: true, | |
}); | |
document.body.appendChild(app.view); | |
const graphics = new PIXI.Graphics(); | |
app.stage.addChild(graphics); | |
let t = 0; | |
function drawPoint(x, y) { | |
let k = 9 * Math.cos(x / 8); | |
let e = y / 8 - 12.5; | |
let d = Math.hypot(k, e) ** 2 / 99 + Math.sin(t) / 6 + 0.5; | |
let angle = Math.atan2(k, e); | |
let q = | |
99 - | |
(e * Math.sin(angle * 7)) / d + | |
k * (3 + Math.cos(d * d - t) * 2); | |
let c = d / 2 + e / 69 - t / 16; | |
let px = q * Math.sin(c) + 200; | |
let py = (q + 19 * d) * Math.cos(c) + 200; | |
graphics.beginFill(0xffffff, 0.3); // półprzezroczysty biały punkt | |
graphics.drawRect(px, py, 1, 1); | |
graphics.endFill(); | |
} | |
app.ticker.add(() => { | |
t += Math.PI / 45; | |
graphics.clear(); | |
graphics.beginFill(0xffffff); // start rysowania (na biało) | |
for (let i = 10000; i--; ) { | |
let x = i % 200; | |
let y = i / 55; | |
drawPoint(x, y); | |
} | |
graphics.endFill(); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment