-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdiagonal-grid.yaml
53 lines (51 loc) · 1.82 KB
/
diagonal-grid.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
45
46
47
48
49
50
51
52
53
import:
- ../space/tile.yaml
- ../patterns/grid.yaml
styles:
polygons-diagonal-grid:
doc:
author:
name: Patricio Gonzalez Vivo
twitter: patriciogv
version: 0.0.1
tangram-version: 0.0.7
licence: MIT
description: |
Apply a diagonal grid pattern to the polygon style. To learn more about patterns check [this chapter from the Book of Shaders](https://thebookofshaders.com/09/)
ui:
shaders:
defines:
GRID_SCALE:
type: number
label: Scale
range:
min: 1.
max: 1000.
step: 1.
GRID_WIDTH:
type: number
label: Width
range:
min: 0.
max: 1.
step: 0.01
GRID_COLOR:
type: color
label: Color
GRID_BACKGROUND_COLOR:
type: color
label: 'Background color'
base: polygons
mix: [space-tile, patterns-grid]
shaders:
defines:
GRID_SCALE: 20.
GRID_WIDTH: .05
GRID_COLOR: color.rgb
GRID_BACKGROUND_COLOR: color.rgb*.5
blocks:
color: |
color.rgb = mix(GRID_COLOR,
GRID_BACKGROUND_COLOR,
diagonalGrid( fract(getTileCoords()*GRID_SCALE),
GRID_WIDTH));