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
| vec2 center = vec2(0.8,0); | |
| float blue = 0.3; | |
| void main() { | |
| vec2 z, c; | |
| float scale = 20.0/iGlobalTime; // zoom in | |
| vec2 uv = gl_FragCoord.xy / iResolution.xy; | |
| c.x = 1.3333 * (uv.x - 0.5) * scale - center.x; | |
| c.y = (uv.y - 0.5) * scale - center.y; |
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
| void main(void) { | |
| // the center of the texture | |
| vec2 center = vec2(iResolution.x/2.0,iResolution.y/2.0); | |
| // current pixel location | |
| vec2 loc = gl_FragCoord.xy; | |
| // how far we are from the center | |
| float radius=length(loc-center); | |
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
| void main(void) { | |
| gl_FragColor = vec4(0,1.0,0,1.0); | |
| } |
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
| class TokenBucket(msgPerSecond:Long, bucketSize:Long) { | |
| var prev = 0L | |
| var tokens = bucketSize | |
| def limit(func: => Any): Any = { | |
| val current = System.currentTimeMillis | |
| val delta = current-prev | |
| prev = current | |
| tokens += delta/1000.0 * msgPerSecond |