Last active
April 24, 2023 22:57
-
-
Save lewdev/5b2134a885d828c397fc475165fc4dac to your computer and use it in GitHub Desktop.
⬛ Tiny Dwitter Editor. Run dweets on your own (Ctrl-Enter to run)
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
| <style>/*Dwitter Shim by Frank Force 2020 - MIT License (https://codepen.io/KilledByAPixel/pen/YzyyOEr)*/*{box-sizing:border-box;margin:0}textarea,iframe{width:100%;height:50vh}</style> | |
| <script>let shim=`<canvas id=c width=1920 height=1080></canvas><script>u=t=>{z} | |
| let time = frame = nextFrameMs = 0 | |
| ,FPS = 60 | |
| ,x = c.getContext("2d") | |
| ,S = Math.sin | |
| ,C = Math.cos | |
| ,T = Math.tan | |
| ,R = (r,g,b,a=1) => "rgba("+[r|0,g|0,b|0,a]+")" | |
| ,loop = frameTime => { | |
| requestAnimationFrame(loop); | |
| if (frameTime < nextFrameMs-2) return; | |
| nextFrameMs = Math.max(nextFrameMs + 1000 / FPS, frameTime); | |
| time = frame / FPS; | |
| if (time*FPS|0 != frame++) time += 1e-6; | |
| u(time); | |
| };loop()<\/script> | |
| <style> | |
| html,body{margin:0;background:#222; display: flex; justify-content: center; align-items: center; height: 100%; } | |
| canvas{background:#fff;max-height: 100%;max-width: 100%;box-shadow: 0px 0px 40px 10px #000;} | |
| <\/style>`; | |
| </script><iframe id=f></iframe> | |
| <textarea id=d spellcheck=false onkeyup=e=event;k=e.keyCode;(e.ctrlKey&&k==13)||k==10?f.srcdoc=shim.replace('z',d.value):0 style=resize:none;filter:invert(1)hue-rotate(180deg)></textarea> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment