summaryrefslogtreecommitdiff
path: root/doc/shaders/util.txt
blob: a455eb32a3c012ff0ab5ccc9b56e666c503c2416 (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
SHADER UTILITIES
================

These are little snippets which may be useful in writing your own shaders.



>> basic way to slow the frame rate of a shader.

window.zz=window.zz||0
if(!(x+y)) zz++
if (lex.bg != 1 && !(zz % 4)) {
  ...
}


>> handy for brushes - use color to mask brush shape

lex.opacity = lex.bg == colors.black ? 0 : 1


Tip: Set to "animate brush", then use option+shift (alt+shift) to
copy color from the canvas. Brush will have the "shape" of the
copied color only.  Can be a cool effect when used with fg/bg only.



>> copy color from canvas at x/y

lex.assign( canvas.get(x,y) )



>> animate canvas up and to the left..

lex.assign( canvas.get(x+1,y+1) )