asciiblaster- draw irc art in your web browser |
git clone git://git.acid.vegas/asciiblaster.git |
Log | Files | Refs | Archive | README |
canvas.txt (3849B)
1 CANVAS SHADERS 2 ============== 3 4 These shaders were written to work on areas of canvas. 5 Make sure "canvas" is selected and "animate" is checked. 6 7 8 >> original shader.. 9 10 lex.bg = hue((x+y*y+t/10)/20) 11 lex.fg = (x+y)%16 12 lex.char = (y%2) ? ":" : "%" 13 14 15 16 >> energy ball ascii shader 17 18 d = dist(x/2+w/4, y, w/2, h/2) 19 an = angle(x/2+w/4, y, w/2,h/2)+t/4200 20 r=10.2 21 22 if (d < r) lex.bg = randint(r) 23 24 ll=abs(an|0)+"" 25 lex.char=ll[ll.length-1] 26 27 if (d > r) { 28 lex.bg = randint(d) 29 lex.fg = randint(d) 30 lex.char = ll[ll.length-2] 31 } 32 33 34 35 >> drifting fire 36 37 t += sin(x/1000)*100000 38 pos = y/h*6 + sin(x*3) - cos(y*t/10000-10) 39 pos = clamp(pos, 0, 6) 40 lex.bg = hue(pos) 41 42 43 44 >> the "bJoel56" shader 45 46 yy=y 47 x-=w/2 48 y-=h/2 49 50 lex.bg = blue(yy/h+random()) 51 lex.fg = green(yy/h*4 + sin(x/100+random()/2)) // hue(t/1000)|0; 52 53 var abcd=".'~:;!>+=icjtJYSGSXDQKHNWM"; 54 function chara (aa,n) { return aa[clamp(n*aa.length, 0, aa.length)|0] } 55 lex.char = chara(abcd, y/h*(5/3 + tan(x/100)+random()/1)) 56 57 58 59 >> frog shader v2 60 61 t/=-100 62 d = sinp( (dist(x/2+w/4, y, w/2, h/2) + t)/2 ) * 10 63 64 lex.char=',./>"ASE$#'[(floor(d))] 65 lex.fg = [1,3,9][floor(d*3)%3] 66 lex.bg=1 67 68 69 70 >> frog shader v3 71 72 // set period to like 0.2 for a normal circle 73 period = y/10 74 75 t/=-100 76 d = sinp( (dist(x/2+w/4, y, w/2, h/2) + t) * period ) 77 dd = d * 10.5 78 d3 = dd < 8 ? 0 : 1 79 80 lex.char=' .,"+/>OXEN'[(floor(dd))] 81 lex.fg = [3,9][floor(d3)] 82 lex.bg=1 83 84 85 86 >> spaceships 87 88 many cool shaders are possible with this technique.. changing the char 89 gradient (lex.char=...) etc. i love how the dots move on v4. 90 91 this is a variation that looks like a bunch of ships flying across the screen. 92 has a really cool 3d look to it cuz the rows move at different speeds. 93 94 period = sin(y) 95 96 t/=-100 97 d = sinp( (dist(x/2+w/4, y, w/2, h/2) + t) * period ) 98 dd = d * 10.5 99 d3 = dd < 8 ? 0 : 1 100 101 lex.char=' .,"+/>\^+'[(floor(dd))] 102 lex.fg = [3,9][floor(d3)] 103 lex.bg=1 104 105 106 107 >> concentric circles with a wavy "sunburst" pattern going around them 108 109 x -= w/2 110 y -= h/2 111 112 x /= h 113 y /= h/2 + 2 114 115 r = dist(x,y,0,0) 116 ang = angle(x,y,0,0) 117 118 if (r < 0.6) { 119 if (abs(mod(sin((r*t)/100000000000) + ang*18,TWO_PI)) < 2) 120 lex.bg = 12 121 else 122 lex.bg = 5 123 } 124 else if (r < 0.65) 125 lex.bg = 4 126 else if (abs(mod(sin((r*t)/100000000000) + ang*18,TWO_PI)) < 2) 127 lex.bg = 7 128 else 129 lex.bg = 8 130 131 132 133 >> slash-based interference patterns 134 135 if (x > h*2) x=h-x 136 y-=h/2 137 t/=2000 138 139 if (sin(x-y*t) > 0) { 140 lex.bg=1 141 lex.fg=4 142 lex.char= Math.floor(x-y*10001+t)%2 ? '\/' : '\\' 143 } 144 else { 145 lex.bg=1 146 lex.fg=9 147 lex.char= Math.floor(3*x+y+t)%2 ? '\\' : ' ' 148 } 149 150 151 152 >> sparkling stars 153 154 if (lex.char != " ") { 155 lex.fg =floor( Math.random()*10 ) 156 var az="Xx+*" 157 lex.char=az[floor(az.indexOf(lex.char)+ t/10000000 +Math.random())%az.length] 158 } 159 160 161 162 >> coogi x/y doodle 163 164 xx=x 165 t/=1000 166 x/=w/2 167 y/=h/2 168 y-=1 169 x-=1 170 x*=x-sin(y/t) 171 y*=1 172 173 lex.bg = 1 // gray( sin(x/(y/3-1)+t) + sin(y/4+t) ) 174 lex.fg = hue( sin((y/5)+t) - cos(x*t) *5 ) 175 lex.char = " _.,:;\"~| "[Math.round(xx*(y+1+(x+t/102)/4)*13)%13] 176 177 178 179 >> glitch shader - produces odd combinations of fg/bg 180 181 lex.char=String.fromCharCode(lex.char.charCodeAt(0)+1) 182 lex.bg+=7 183 lex.fg+=5 184 185 186 187 >> dots / lines shader 188 189 xx = ((t/10*x)*y/10)%8 190 lex.bg = colors.black 191 lex.fg = green(x*3+y*5) 192 lex.char = ((xx%1) !== 0) ? " " : " .,;=+!@"[xx] 193 194 195 196 >> munching squares horizon 197 198 t/=100 199 y+=10 200 x-=w/2 201 x/=y/10 202 lex.bg=hue((x^y)+t) 203 204 205 206 >> grayscale vertical interlacing 207 208 First, make a canvas that's totally white. 209 210 Run this shader: 211 212 if (lex.bg == 0) { 213 lex.bg = ((x)%2) ? 15 : 14 214 } 215 216 Then set your brush to a white square. 217 218 Run this shader w/ animate: 219 220 if (lex.bg == 0) { 221 lex.bg = ((x)%2) ? 0 : 1 222 } 223 224 225 226 >> nice purple/orange texture 227 228 lex.bg=colors.purple 229 lex.fg=colors.orange 230 x/=3 231 x=floor(x+y/2.1) // <- this is cool number to change 232 if (x+10*sin(x)+10*cos(y/(t%100)) < y/3) { 233 lex.char="abcdefghijklmnopqrstuvwxyz"[x%26] 234 } else { 235 lex.char="abcdefghijklmnopqrstuvwxyz".toUpperCase()[x%26] 236 } 237