summaryrefslogtreecommitdiff
path: root/doc/shaderz.txt
diff options
context:
space:
mode:
authorJules <jules@asdf.us>2016-03-22 11:45:42 -0400
committerJules <jules@asdf.us>2016-03-22 11:45:42 -0400
commit89d32364d11f1be78dae9644c0d3176967a3c944 (patch)
treec4832bf60f41d031cacf0896e3fe3e06c87bf4e7 /doc/shaderz.txt
parent6a30feead73dbee2d664b0099efcdc5106096c55 (diff)
docs
Diffstat (limited to 'doc/shaderz.txt')
-rw-r--r--doc/shaderz.txt105
1 files changed, 105 insertions, 0 deletions
diff --git a/doc/shaderz.txt b/doc/shaderz.txt
new file mode 100644
index 0000000..53a5f84
--- /dev/null
+++ b/doc/shaderz.txt
@@ -0,0 +1,105 @@
+
+>> energy ball ascii shader
+
+d = dist(x/2+w/4, y, w/2, h/2)
+an = angle(x/2+w/4, y, w/2,h/2)+t/4200
+r=10.2
+
+if (d < r) lex.bg = randint(r)
+
+ll=abs(an|0)+""
+lex.char=ll[ll.length-1]
+
+if (d > r) {
+ lex.bg = randint(d)
+ lex.fg = randint(d)
+ lex.char = ll[ll.length-2]
+}
+
+
+>> original shader..
+
+lex.bg = hue((x+y*y+t/10)/20)
+lex.fg = (x+y)%16
+lex.char = (y%2) ? ":" : "%"
+
+
+
+>> drifting fire
+
+t += sin(x/1000)*100000
+pos = y/h*6 + sin(x*3) - cos(y*t/10000-10)
+pos = clamp(pos, 0, 6)
+lex.bg = hue(pos)
+
+
+
+>> the "bJoel56" shader
+
+yy=y
+x-=w/2
+y-=h/2
+
+lex.bg = blue(yy/h+random())
+lex.fg = green(yy/h*4 + sin(x/100+random()/2)) // hue(t/1000)|0;
+
+var abcd=".'~:;!>+=icjtJYSGSXDQKHNWM";
+function chara (aa,n) { return aa[clamp(n*aa.length, 0, aa.length)|0] }
+lex.char = chara(abcd, y/h*(5/3 + tan(x/100)+random()/1))
+
+
+
+>> noise brushes, works on a black background:
+
+if (lex.bg != 1) lex.bg = max(5, yellow(randint(t)))
+
+
+>> simple rainbow:
+
+if (lex.bg != 1) lex.bg = randint(t)
+
+
+>> self-erasing:
+
+if (lex.bg != 1) lex.bg = yellow(randint(t))
+
+
+>> cycling rainbow brush
+
+if (lex.bg != 1) lex.bg = hue( all_color_hue_order.indexOf( color_names[ lex.bg ] ) + 1 )
+
+
+
+>> inelegant way to slow the frame rate of a shader.
+
+window.zz=window.zz||0
+if(!(x+y)) zz++
+if (lex.bg != 1 && !(zz % 4)) {
+ ...
+}
+
+
+>> frog shader v2
+
+t/=-100
+d = sinp( (dist(x/2+w/4, y, w/2, h/2) + t)/2 ) * 10
+
+lex.char=',./>"ASE$#'[(floor(d))]
+lex.fg = [1,3,9][floor(d*3)%3]
+lex.bg=1
+
+
+>> frog shader v3
+
+// set period to like 0.2 for a normal circle
+period = y/10
+
+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=' .,"+/>OXEN'[(floor(dd))]
+lex.fg = [3,9][floor(d3)]
+lex.bg=1
+