summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJules <jules@asdf.us>2016-03-22 12:03:40 -0400
committerJules <jules@asdf.us>2016-03-22 12:03:40 -0400
commit6ea10eb0e9ca7c7785f47424ff7f3d300e691fd1 (patch)
treed8c37de1d5a5f8ba5367dce0f7ad9e3229003a0a /doc
parentccaa6a4d7106ad1cac89c6db743089108bd5739e (diff)
more shaders
Diffstat (limited to 'doc')
-rw-r--r--doc/shaderz.txt168
1 files changed, 168 insertions, 0 deletions
diff --git a/doc/shaderz.txt b/doc/shaderz.txt
index 53a5f84..f1af1d8 100644
--- a/doc/shaderz.txt
+++ b/doc/shaderz.txt
@@ -103,3 +103,171 @@ lex.char=' .,"+/>OXEN'[(floor(dd))]
lex.fg = [3,9][floor(d3)]
lex.bg=1
+
+many cool shaders are possible with this technique.. changing the char
+gradient (lex.char=...) etc. i love how the dots move on v4.
+
+this is a variation that looks like a bunch of ships flying across the screen.
+has a really cool 3d look to it cuz the rows move at different speeds.
+
+period = sin(y)
+
+t/=-100
+d = sinp( (dist(x/2+w/4, y, w/2, h/2) + t) * period )
+dd = d * 10.5
+d3 = dd < 8 ? 0 : 1
+
+lex.char=' .,"+/>\^+'[(floor(dd))]
+lex.fg = [3,9][floor(d3)]
+lex.bg=1
+
+
+>> "stars" brush.. set your brush to paint just the character "#"
+
+if (lex.char == "#") {
+ lex.fg = hue(randint(15))
+ lex.char = random() > 0.1 ? " " : "+@*.,\"+'*-"[randint(10)]
+}
+
+
+>> use fg char to mask mask what you're drawing on the bg
+
+if (lex.char != "/") { lex.bg = 1 }
+
+
+>> concentric circles with a wavy "sunburst" pattern going around them
+
+
+x -= w/2
+y -= h/2
+
+x /= h
+y /= h/2 + 2
+
+r = dist(x,y,0,0)
+ang = angle(x,y,0,0)
+
+if (r < 0.6) {
+ if (abs(mod(sin((r*t)/100000000000) + ang*18,TWO_PI)) < 2)
+ lex.bg = 12
+ else
+ lex.bg = 5
+}
+else if (r < 0.65)
+ lex.bg = 4
+else if (abs(mod(sin((r*t)/100000000000) + ang*18,TWO_PI)) < 2)
+ lex.bg = 7
+else
+ lex.bg = 8
+
+
+>> slash-based interference patterns
+
+if (x > h*2) x=h-x
+y-=h/2
+t/=2000
+
+if (sin(x-y*t) > 0) {
+ lex.bg=1
+ lex.fg=4
+ lex.char= Math.floor(x-y*10001+t)%2 ? '\/' : '\\'
+}
+else {
+ lex.bg=1
+ lex.fg=9
+ lex.char= Math.floor(3*x+y+t)%2 ? '\\' : ' '
+}
+
+
+>> sparkling stars
+
+if (lex.char != " ") {
+ lex.fg =floor( Math.random()*10 )
+ var az="Xx+*"
+ lex.char=az[floor(az.indexOf(lex.char)+ t/10000000 +Math.random())%az.length]
+}
+
+
+>> clashing contrast text..
+
+First, make a canvas that's totally white.
+
+Run this shader:
+
+if (lex.bg == 0) {
+ lex.bg = ((x)%2) ? 15 : 14
+}
+
+Then set your brush to a white square.
+
+Run this shader w/ animate:
+
+if (lex.bg == 0) {
+ lex.bg = ((x)%2) ? 0 : 1
+}
+
+
+>> glitch shader - produces odd combinations of fg/bg
+
+lex.char=String.fromCharCode(lex.char.charCodeAt(0)+1)
+lex.bg+=7
+lex.fg+=5
+
+
+>> coogi x/y doodle
+
+xx=x
+t/=1000
+x/=w/2
+y/=h/2
+y-=1
+x-=1
+x*=x-sin(y/t)
+y*=1
+
+ lex.bg = 1 // gray( sin(x/(y/3-1)+t) + sin(y/4+t) )
+ lex.fg = hue( sin((y/5)+t) - cos(x*t) *5 )
+ lex.char = " _.,:;\"~| "[Math.round(xx*(y+1+(x+t/102)/4)*13)%13]
+
+
+>> dots / lines shader
+
+ xx = ((t/10*x)*y/10)%8
+ lex.bg = colors.black
+ lex.fg = green(x*3+y*5)
+ lex.char = ((xx%1) !== 0) ? " " : " .,;=+!@"[xx]
+
+
+>> munching squares horizon
+
+t/=100
+y+=10
+x-=w/2
+x/=y/10
+lex.bg=hue((x^y)+t)
+
+
+>> sharded glitch brush
+
+Example: http://asdf.us/z/kksnvs.png
+
+Use on a brush:
+
+lex.bg = t/y/x
+lex.opacity = lex.bg % 1 ? 0 : 1
+
+
+>> incremental brush
+
+Set your brush to be the ^ character, square, about 10x10
+Draw "char" only
+Then animate this shader on the canvas:
+
+if (lex.char=="^") {
+ lex.bg += 1
+ lex.char = " "
+}
+lex.bg += 1
+
+
+