Skip to content

Commit

Permalink
update shader canvas when // size: specified
Browse files Browse the repository at this point in the history
  • Loading branch information
garrisonhh committed Jan 18, 2025
1 parent b698181 commit 8dd8984
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions shader.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
position: fixed;
pointer-events: none;
image-rendering: pixelated;
width: 100%;
height: 100%;
}

.canvas-small {
Expand All @@ -20,6 +18,8 @@
.canvas-fullscreen {
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>
<script>
Expand Down
2 changes: 2 additions & 0 deletions src/shader.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,10 @@ export class ShaderSession {
this.uniforms = this.instance.uniforms;
if (code.indexOf('// size: fullscreen') > -1) {
fullscreenCanvas(this.canvas);
this.instance.update();
} else if (code.indexOf('// size: small') > -1) {
smallCanvas(this.canvas);
this.instance.update();
}
console.log('Shader updated!');
} catch (err) {
Expand Down

0 comments on commit 8dd8984

Please sign in to comment.