-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
95 lines (78 loc) · 1.97 KB
/
Copy pathscript.js
File metadata and controls
95 lines (78 loc) · 1.97 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
89
90
91
92
93
94
95
var cursorMode = 0;
var colorHistory;
function setup() {
createCanvas(windowWidth, windowHeight*0.9);
background(255);
}
function draw() {
background(0,0);
stroke(255);
var dd = dist(pmouseX,pmouseY, mouseX,mouseY)
if (cursorMode==1){ //1赤
stroke('red');
strokeWeight(log(dd)*5);
strokeCap(ROUND);
line(pmouseX,pmouseY, mouseX,mouseY)
}else if(cursorMode==2){ //2オレンジ
stroke('orange');
strokeWeight(log(dd)*5);
strokeCap(ROUND);
line(pmouseX,pmouseY, mouseX,mouseY)
}else if(cursorMode==3){ //3黄
stroke('yellow');
strokeWeight(log(dd)*5);
strokeCap(ROUND);
line(pmouseX,pmouseY, mouseX,mouseY)
}else if(cursorMode==4){ //4緑
stroke('green');
strokeWeight(log(dd)*5);
strokeCap(ROUND);
line(pmouseX,pmouseY, mouseX,mouseY)
}else if(cursorMode==5){ //5青
stroke('blue');
strokeWeight(log(dd)*5);
strokeCap(ROUND);
line(pmouseX,pmouseY, mouseX,mouseY)
}else if(cursorMode==6){ //6藍
stroke('Indigo');
strokeWeight(log(dd)*5);
strokeCap(ROUND);
line(pmouseX,pmouseY, mouseX,mouseY)
}else if(cursorMode==7){ //7紫
stroke('purple');
strokeWeight(log(dd)*5);
strokeCap(ROUND);
line(pmouseX,pmouseY, mouseX,mouseY)
}else if(cursorMode==8){ //8黒
stroke('black');
strokeWeight(log(dd)*5);
strokeCap(ROUND);
line(pmouseX,pmouseY, mouseX,mouseY)
}else if(cursorMode==9){ //9消しゴム
stroke(255);
strokeWeight(log(dd)*20);
strokeCap(ROUND);
line(pmouseX,pmouseY, mouseX,mouseY)
}else if(cursorMode==0){ //0ペン上げる
stroke(0,0,0,0);
strokeWeight(log(dd)*1);
strokeCap(ROUND);
line(pmouseX,pmouseY, mouseX,mouseY)
}
// ellipse(mouseX, mouseY, 20, 20);
}
function mousePressed() {
//クリック時
colorHistory = cursorMode;
console.log(colorHistory);
// cursorMode = floor(random(1,4));
cursorMode = 9;
// console.log(cursorMode)
}
function mouseClicked() {
cursorMode = colorHistory;
}
function keyPressed(){
cursorMode=key;
console.log(cursorMode)
}