|
1 | 1 | import globals from './PGlobals.js'
|
2 |
| -import { draw_x }from "./PDrawingHelpers.js" |
| 2 | +import { draw_x, draw_dashed_rect }from "./PDrawingHelpers.js" |
3 | 3 |
|
4 | 4 | export const output_symbol = function(ParametricWallpaper){
|
5 | 5 |
|
6 | 6 | return function(){
|
| 7 | + |
| 8 | + var w = ParametricWallpaper.grid_settings.cell_width; |
| 9 | + var h = ParametricWallpaper.grid_settings.cell_height; |
| 10 | + |
7 | 11 | push();
|
8 |
| - translate(width/2, height/2); |
| 12 | + scale(ParametricWallpaper.resolution().scale); |
| 13 | + translate(width/2 , height/2); |
| 14 | + scale(3); |
| 15 | + translate(-w/2 , -h/2); |
9 | 16 | push();
|
| 17 | + draw_dashed_rect(0,0,w,h); |
10 | 18 | my_symbol(0, 0);
|
11 | 19 | pop();
|
12 |
| - strokeWeight(2); |
13 |
| - draw_x(0, 0, 5); |
14 | 20 | pop();
|
15 | 21 | }
|
16 | 22 |
|
17 | 23 | }
|
18 | 24 |
|
19 |
| -export const output_wallpaper = function(ParametricWallpaper){ |
| 25 | +export const grid_wallpaper = function(ParametricWallpaper){ |
| 26 | + |
| 27 | + return function(){ |
| 28 | + |
| 29 | + var w = ParametricWallpaper.grid_settings.cell_width; |
| 30 | + var h = ParametricWallpaper.grid_settings.cell_height; |
| 31 | + var offset = ParametricWallpaper.grid_settings.row_offset; |
| 32 | + |
| 33 | + push(); |
| 34 | + scale(ParametricWallpaper.resolution().scale); |
| 35 | + for(var i = -w; i < width+w; i += w){ |
| 36 | + var row = 0; |
| 37 | + for(var j = -h; j < height+h; j += h){ |
| 38 | + var shift = row%2 == 0 ? 0 : offset; |
| 39 | + push(); |
| 40 | + translate(i+shift, j); |
| 41 | + my_symbol(0, 0); |
| 42 | + if(ParametricWallpaper.show_guide()){ |
| 43 | + draw_dashed_rect(0,0,w,h); |
| 44 | + } |
| 45 | + pop(); |
| 46 | + row++; |
| 47 | + } |
| 48 | + } |
| 49 | + pop(); |
| 50 | + } |
| 51 | + |
| 52 | +} |
| 53 | + |
| 54 | +export const glide_wallpaper = function(ParametricWallpaper){ |
20 | 55 |
|
21 |
| - // return function(layer){ |
22 |
| - // push(); |
23 |
| - // set_initial_transforms(pScope); |
24 |
| - // translate(0, pScope._wedge_size/2.0); |
25 |
| - // layer.draw_boundry(); |
26 |
| - // layer.animation_function(0, layer.boundary.low, layer.boundary.high); |
27 |
| - // pop(); |
28 |
| - // } |
| 56 | + |
| 57 | + return function(){ |
| 58 | + |
| 59 | + var w = ParametricWallpaper.grid_settings.cell_width; |
| 60 | + var h = ParametricWallpaper.grid_settings.cell_height; |
| 61 | + var offset = ParametricWallpaper.grid_settings.row_offset; |
| 62 | + |
| 63 | + function symbol_and_guide(){ |
| 64 | + my_symbol(0, 0); |
| 65 | + if(ParametricWallpaper.show_guide()){ |
| 66 | + draw_dashed_rect(0,0,w,h); |
| 67 | + } |
| 68 | + } |
| 69 | + |
| 70 | + push(); |
| 71 | + scale(ParametricWallpaper.resolution().scale); |
| 72 | + for(var i = -w*2; i < width+w*2; i += w*2){ |
| 73 | + var row = 0; |
| 74 | + for(var j = -h; j < height+h; j += h){ |
| 75 | + push(); |
| 76 | + translate(i, j); |
| 77 | + symbol_and_guide(); |
| 78 | + translate(w*2, offset); |
| 79 | + scale(-1, 1); |
| 80 | + symbol_and_guide(); |
| 81 | + pop(); |
| 82 | + row++; |
| 83 | + } |
| 84 | + } |
| 85 | + pop(); |
| 86 | + } |
29 | 87 |
|
30 | 88 | }
|
0 commit comments