forked from nahbee10naver/nahbee10naver.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
multiple_path.html
190 lines (181 loc) · 4.79 KB
/
multiple_path.html
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Multiple Paths Test</title>
<style>
html,
body {
margin: 0;
overflow: hidden;
height: 100%;
}
/* Scale canvas with resize attribute to full size */
canvas[resize] {
width: 100%;
height: 100%;
}
</style>
<script type="text/javascript" src="paper-full.js"></script>
<script type="text/paperscript" canvas="canvas">
var textItem = new PointText({
content: '발행일',
point: new Point(47.3002, 146.6312),
fillColor: 'black',
fontSize:'87',
fontWeight:'600'
});
textItem.fillColor = '#ff00ff';
textItem.strokeColor = '#000000';
var textItem = new PointText({
content: '디자인',
point: new Point(844.2524, 467.2025),
fillColor: 'black',
fontSize:'87',
fontWeight:'600'
});
var textItem = new PointText({
content: '발행처',
point: new Point(388.7867, 146.6313),
fillColor: 'black',
fontSize:'87',
fontWeight:'600'
});
var textItem = new PointText({
content: '발행인',
point: new Point(47.3,467.203),
fillColor: 'black',
fontSize:'87',
fontWeight:'600'
});
var textItem = new PointText({
content: '기획/제작',
point: new Point(389.7864,467.2026),
fillColor: 'black',
fontSize:'87',
fontWeight:'600'
});
var textItem = new PointText({
content: 'studio nahbee',
point: new Point(855.2731, 534.991),
fillColor: 'black',
fontSize:'36',
fontWeight:'600'
});
var textItem = new PointText({
content: '2016년',
point: new Point(56.134, 217.4704),
fillColor: 'black',
fontSize:'36',
fontWeight:'600'
});
var textItem = new PointText({
content: 'I WILL SEOUL U',
point: new Point(396.2502, 534.6646),
fillColor: 'black',
fontSize:'36',
fontWeight:'600'
});
var textItem = new PointText({
content: '기획/제작팀',
point: new Point(396.2502, 576.6646),
fillColor: 'black',
fontSize:'36',
fontWeight:'600'
});
var textItem = new PointText({
content: '서울특별시',
point: new Point(396.2501, 218.4704),
fillColor: 'black',
fontSize:'36',
fontWeight:'600'
});
var textItem = new PointText({
content: '미래유산관광',
point: new Point(396.2501, 260.4704),
fillColor: 'black',
fontSize:'36',
fontWeight:'600'
});
var textItem = new PointText({
content: 'Seoul Special City',
point: new Point(396.2501, 302.4704),
fillColor: 'black',
fontSize:'36',
fontWeight:'600'
});
var textItem = new PointText({
content: 'Department of Aborted Future',
point: new Point(396.2501, 342.4704),
fillColor: 'black',
fontSize:'36',
fontWeight:'600'
});
var textItem = new PointText({
content: '서울특별시장',
point: new Point(54.9998, 537.3906),
fillColor: 'black',
fontSize:'36',
fontWeight:'600'
});
var textItem = new PointText({
content: 'Seoulspecialmarket',
point: new Point(54.9998, 579.3906),
fillColor: 'black',
fontSize:'32',
fontWeight:'600'
});
var hitOptions = {
segments: true,
stroke: true,
fill: true,
tolerance: 5
};
var segment, path;
var movePath = false;
function onMouseDown(event) {
segment = path = null;
var hitResult = project.hitTest(event.point, hitOptions);
if (!hitResult)
return;
if (event.modifiers.shift) {
if (hitResult.type == 'segment') {
hitResult.segment.remove();
};
return;
}
if (hitResult) {
path = hitResult.item;
if (hitResult.type == 'segment') {
segment = hitResult.segment;
} else if (hitResult.type == 'stroke') {
var location = hitResult.location;
segment = path.insert(location.index + 1, event.point);
path.smooth();
}
}
movePath = hitResult.type == 'fill';
console.log(project.activeLayer);
if (movePath)
project.activeLayer.addChild(hitResult.item);
}
function onMouseMove(event) {
//firstGroup.position = event.point;
project.activeLayer.selected = false;
if (event.item)
event.item.selected = true;
}
function onMouseDrag(event) {
/*if (segment) {
segment.point += event.delta;
path.smooth();
} else */if (path) {
path.position += event.delta;
}
}
</script>
</head>
<body>
<canvas id="canvas" width="1159" height="694.8" style="position:absolute; top:0px;left:0px;background:#00ff00;"></canvas>
</body>
</html>