summaryrefslogtreecommitdiff
path: root/doc/shaders/brush.txt
blob: 8a5f6723a204ebf3914089ff19706606a24683a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
BRUSH SHADERS
=============

Unless noted, these shaders were written to work on the brush itself.
Make sure "brush" is selected and "animate" is checked.


>> distressed texture brush

Sample use of the "choice" function to get a random color.

var char = choice("      abcdef      ")
lex.bg = +choice("0124")
lex.fg = +choice("01234")
lex.char = char
lex.opacity = char == " " ? 0 : 1



>> foggy terrain brush

var char = choice("      abcdef      ")
lex.bg = choice([14,15])
lex.fg = choice("367")
lex.char = char
lex.opacity = char == " " ? 0 : 1



>> mirror brush (left-right)

NOTE: Animate this on the canvas, then draw:

if (x > w/2) {
  lex.assign( canvas.aa[y][w-x] )
}



>> mirror brush (up-down)

NOTE: Animate this on the canvas, then draw:

if (x > h/2) {
  lex.assign( canvas.aa[h-y][x] )
}



>> rainbow stardust brush

Uncheck BG and animate this to brush:

lex.fg = hue(t)
lex.char = choice("            ,'.,.','******    ")



>> noise brushes, works on a black background:

lex.bg = max(5, yellow(randint(t)))
lex.opacity = lex.bg == colors.black ? 0 : 1



>> simple rainbow:

if (lex.bg != 1) lex.bg = randint(t)
lex.opacity = lex.bg == colors.black ? 0 : 1



>> self-erasing:

if (lex.bg != 1) lex.bg = yellow(randint(t))
lex.opacity = lex.bg == colors.black ? 0 : 1



>> cycling rainbow brush

if (lex.bg != 1) lex.bg = hue( all_color_hue_order.indexOf( color_names[ lex.bg ] ) + 1 )
lex.opacity = lex.bg == colors.black ? 0 : 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 }



>> 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