-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPOutputFunctions.js
More file actions
88 lines (71 loc) · 2.19 KB
/
Copy pathPOutputFunctions.js
File metadata and controls
88 lines (71 loc) · 2.19 KB
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
import globals from './PGlobals.js'
import { draw_x, draw_dashed_rect }from "./PDrawingHelpers.js"
export const output_symbol = function(ParametricWallpaper){
return function(){
var w = ParametricWallpaper.grid_settings.cell_width;
var h = ParametricWallpaper.grid_settings.cell_height;
push();
scale(ParametricWallpaper.resolution().scale);
translate(width/2 , height/2);
scale(3);
translate(-w/2 , -h/2);
push();
draw_dashed_rect(0,0,w,h);
my_symbol(0, 0);
pop();
pop();
}
}
export const grid_wallpaper = function(ParametricWallpaper){
return function(){
var w = ParametricWallpaper.grid_settings.cell_width;
var h = ParametricWallpaper.grid_settings.cell_height;
var offset = ParametricWallpaper.grid_settings.row_offset;
push();
scale(ParametricWallpaper.resolution().scale);
for(var i = -w; i < width+w; i += w){
var row = 0;
for(var j = -h; j < height+h; j += h){
var shift = row%2 == 0 ? 0 : offset;
push();
translate(i+shift, j);
my_symbol(0, 0);
if(ParametricWallpaper.show_guide()){
draw_dashed_rect(0,0,w,h);
}
pop();
row++;
}
}
pop();
}
}
export const glide_wallpaper = function(ParametricWallpaper){
return function(){
var w = ParametricWallpaper.grid_settings.cell_width;
var h = ParametricWallpaper.grid_settings.cell_height;
var offset = ParametricWallpaper.grid_settings.row_offset;
function symbol_and_guide(){
my_symbol(0, 0);
if(ParametricWallpaper.show_guide()){
draw_dashed_rect(0,0,w,h);
}
}
push();
scale(ParametricWallpaper.resolution().scale);
for(var i = -w*2; i < width+w*2; i += w*2){
var row = 0;
for(var j = -h; j < height+h; j += h){
push();
translate(i, j);
symbol_and_guide();
translate(w*2, offset);
scale(-1, 1);
symbol_and_guide();
pop();
row++;
}
}
pop();
}
}