-
Notifications
You must be signed in to change notification settings - Fork 5
/
pixelate.yaml
44 lines (42 loc) · 1.58 KB
/
pixelate.yaml
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
import:
- ../generative/random.yaml
- ../space/tile.yaml
styles:
polygons-pixelate:
doc:
author:
name: Patricio Gonzalez Vivo
twitter: patriciogv
version: 0.0.1
tangram-version: 0.0.7
licence: MIT
description: |
Apply a random pixelated pattern to the polygon style. To learn more about patterns or random check [this chapter](https://thebookofshaders.com/09/) or [this other chapter from the Book of Shaders](https://thebookofshaders.com/10/)
ui:
shaders:
defines:
PIXELATE_SCALE:
type: number
label: Scale
range:
min: 1.
max: 1000.
step: 1.
PIXELATE_COLOR:
type: color
label: Color
PIXELATE_BACKGROUND_COLOR:
type: color
label: 'Background color'
base: polygons
mix: [space-tile, generative-random]
shaders:
defines:
PIXELATE_SCALE: 40.
PIXELATE_COLOR: color.rgb*.5
PIXELATE_BACKGROUND_COLOR: color.rgb
blocks:
color: |
color.rgb = mix(PIXELATE_BACKGROUND_COLOR,
PIXELATE_COLOR,
random(floor(getTileCoords()*PIXELATE_SCALE)));