mirror of
https://github.com/dyuri/repa-shader.git
synced 2025-12-16 11:14:25 +00:00
58 lines
1.4 KiB
HTML
58 lines
1.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title><repa-shader> demo</title>
|
|
<script type="module" src="../src/repa-shader.js"></script>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
padding: 0;
|
|
background: repeating-linear-gradient(45deg, #333, #333 10px, #666 10px, #666 20px);
|
|
min-height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
flex-direction: column;
|
|
}
|
|
#fsinput {
|
|
width: 90vw;
|
|
height: 50vh;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<repa-shader fs-input="fsinput" alpha mouse snippets="noise.glsl" width=512 height=512>
|
|
<script type="x-shader/x-fragmen[DELETE]t">
|
|
// https://twigl.app/?ol=true&ss=-NOAlYulOVLklxMdxBDx
|
|
void main() {
|
|
vec2 n,N,q,p=FC.xy/r.y;
|
|
float S=9.,a,j;
|
|
for(mat2 m=rotate2D(5.);j++<30.;){
|
|
p*=m;
|
|
n*=m;
|
|
q=p*S+j+n+t;
|
|
a+=dot(cos(q)/S,r/r);
|
|
n+=q=sin(q);
|
|
N+=q/(S+60.);
|
|
S*=1.2;
|
|
}
|
|
o+=pow(max(o-o,(a+.5)*.1*vec4(6,1,2,0)+.003/length(N)),o-o+.45);
|
|
}
|
|
</script>
|
|
</repa-shader>
|
|
<div>
|
|
<textarea id="fsinput"></textarea>
|
|
</div>
|
|
<button id="update">Update</button>
|
|
<script>
|
|
const updateButton = document.getElementById('update');
|
|
updateButton.addEventListener('click', () => {
|
|
const fsinput = document.getElementById('fsinput');
|
|
const shader = document.querySelector('repa-shader');
|
|
shader.render(fsinput.value);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|