This repository has been archived by the owner on Nov 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
draw.js
99 lines (76 loc) · 1.99 KB
/
draw.js
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
96
97
98
99
paper.install(window);
var bluePen, blackCloud, redPen, greenPen, blackPen, yellowPen, orangePen, eraser;
window.onload = function(){
paper.setup('myCanvas');
var path;
function onMouseDown(event){
path = new Path();
path.strokeColor = 'black';
path.add(event.point);
}
//eraser
circle = new Tool();
circle.onMouseDown = onMouseDown;
circle.onMouseDrag = function(event){
path.strokeWidth = "20";
path.strokeColor = "white";
path.add(event.point);
};
//blue pen
bluePen = new Tool();
bluePen.onMouseDown = onMouseDown;
bluePen.onMouseDrag = function(event) {
path.strokeColor = 'blue';
path.add(event.point);
};
//red Lines
redPen = new Tool();
redPen.onMouseDown = onMouseDown;
redPen.onMouseDrag = function(event){
path.strokeColor = 'red';
path.add(event.point);
};
//green lines
greenPen = new Tool();
greenPen.onMouseDown = onMouseDown;
greenPen.onMouseDrag = function(event){
path.strokeColor = 'green';
path.add(event.point);
};
//black Lines
blackPen = new Tool();
blackPen.onMouseDown = onMouseDown;
blackPen.onMouseDrag = function(event){
path.strokeColor = 'black';
path.add(event.point);
};
//Yellow Lines
yellowPen = new Tool();
yellowPen.onMouseDown = onMouseDown;
yellowPen.onMouseDrag = function(event){
path.strokeColor = 'yellow';
path.add(event.point);
};
//Orange pen
orangePen = new Tool();
orangePen.onMouseDown = onMouseDown;
orangePen.onMouseDrag = function(event){
path.strokeColor = 'orange';
path.add(event.point);
};
//blackCloud
blackCloud = new Tool();
blackCloud.minDistance = 20;
blackCloud.onMouseDown = onMouseDown;
blackCloud.onMouseDrag = function(event) {
path.arcTo(event.point);
};
//blueCloud
blueCloud = new Tool();
blueCloud.minDistance = 20;
blueCloud.onMouseDown = onMouseDown;
blueCloud.onMouseDrag = function(event) {
path.strokeColor = "pink";
path.arcTo(event.point);
};
};