Update public/sketch.js
Browse files- public/sketch.js +35 -29
public/sketch.js
CHANGED
@@ -30,7 +30,7 @@ function preload(){
|
|
30 |
hf_tkn = arg[1];
|
31 |
console.log(space_uri)
|
32 |
|
33 |
-
|
34 |
//setTimeout(function(){
|
35 |
// for (let i = 0; i < AS.initial_frame_nb; i++) {
|
36 |
// AS.create_new_frame();
|
@@ -44,31 +44,34 @@ function preload(){
|
|
44 |
function setup() {
|
45 |
|
46 |
canvas = createCanvas(512, 512);
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
Draws = new DrawHandler();
|
54 |
-
|
55 |
-
|
56 |
|
|
|
|
|
|
|
|
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
|
67 |
|
68 |
Cursor = new OrientedCursor('canvas');
|
69 |
-
|
70 |
Pencil = new BrushPoint('pencil', 0, 0);
|
71 |
-
|
72 |
|
73 |
|
74 |
|
@@ -143,19 +146,22 @@ function draw() {
|
|
143 |
|
144 |
image(AS.frameGraphics, 0, 0)
|
145 |
image(Draws.drawGraphic, 0, 0)
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
if(grAPI.show_diffused == true){
|
155 |
|
156 |
-
|
|
|
|
|
|
|
157 |
}
|
158 |
|
|
|
159 |
if(Draws.isDrawing){
|
160 |
|
161 |
//Cursor.showCursor(mouseX, mouseY);
|
|
|
30 |
hf_tkn = arg[1];
|
31 |
console.log(space_uri)
|
32 |
|
33 |
+
grAPI = new GRAPI(space_uri, hf_tkn);
|
34 |
//setTimeout(function(){
|
35 |
// for (let i = 0; i < AS.initial_frame_nb; i++) {
|
36 |
// AS.create_new_frame();
|
|
|
44 |
function setup() {
|
45 |
|
46 |
canvas = createCanvas(512, 512);
|
47 |
+
canvas.id('canvas');
|
48 |
+
canvas.parent('canvas-ctn');
|
49 |
+
noLoop();
|
50 |
+
pixelDensity(1);
|
51 |
+
background('white');
|
52 |
+
|
53 |
Draws = new DrawHandler();
|
54 |
+
AS = new AnimSys(12, 12, 30, 8);
|
|
|
55 |
|
56 |
+
// for (let i = 0; i < AS.initial_frame_nb; i++) {
|
57 |
+
// AS.create_new_frame();
|
58 |
+
// AS.display_frame(0);
|
59 |
+
// }
|
60 |
|
61 |
+
canvas.mousePressed(function(){
|
62 |
+
Draws.startPath();
|
63 |
+
});
|
64 |
+
canvas.mouseReleased(function(){
|
65 |
+
Draws.endPath(Draws.drawGraphic, AS.frameGraphics);
|
66 |
+
Draws.drawings = [];
|
67 |
+
AS.update_frame();
|
68 |
+
});
|
69 |
|
70 |
|
71 |
Cursor = new OrientedCursor('canvas');
|
72 |
+
Cursor.catchCursor();
|
73 |
Pencil = new BrushPoint('pencil', 0, 0);
|
74 |
+
brushesPoints.push(Pencil);
|
75 |
|
76 |
|
77 |
|
|
|
146 |
|
147 |
image(AS.frameGraphics, 0, 0)
|
148 |
image(Draws.drawGraphic, 0, 0)
|
149 |
+
|
150 |
+
if(grAPI !== undefined){
|
151 |
+
push();
|
152 |
+
grAPI.hiddenScribbleGraphics.clear();
|
153 |
+
grAPI.hiddenScribbleGraphics.background('white');
|
154 |
+
grAPI.hiddenScribbleGraphics.image(AS.frameGraphics, 0, 0);
|
155 |
+
grAPI.hiddenScribbleGraphics.filter(INVERT)
|
156 |
+
pop();
|
|
|
157 |
|
158 |
+
if(grAPI.show_diffused == true){
|
159 |
+
|
160 |
+
image(grAPI.diffusedGraphics, 0, 0);
|
161 |
+
}
|
162 |
}
|
163 |
|
164 |
+
|
165 |
if(Draws.isDrawing){
|
166 |
|
167 |
//Cursor.showCursor(mouseX, mouseY);
|