-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommonFunctions.js
More file actions
53 lines (47 loc) · 984 Bytes
/
Copy pathcommonFunctions.js
File metadata and controls
53 lines (47 loc) · 984 Bytes
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
function clearShadow()
{
context.shadowBlur = 0;
context.shadowOffsetX = 0;
context.shadowOffsetY = 0;
}
function drawShadow()
{
context.shadowColor = '#999';
context.shadowBlur = 20;
context.shadowOffsetX = 15;
context.shadowOffsetY = 15;
}
function drawCircle(x, y, radius)
{
context.beginPath();
context.arc(x, y, radius, 0, 2*Math.PI, false);
context.fill();
context.stroke();
}
function drawLine(x0, y0, x1, y1)
{
context.lineWidth = 12;
context.lineCap = 'round';
context.moveTo(x0,y0);
context.lineTo(x1,y1);
context.stroke();
context.lineWidth = 5;
}
function drawCurveLine(x, y, radius, startAngle, endAngle, counterClockwise)
{
context.beginPath();
context.arc(centerX, 70, 55, 0.75 * Math.PI, 0.25 * Math.PI, true);
context.stroke();
}
function drawCircleWithShadow(x, y, radius)
{
drawShadow();
drawCircle(x, y, radius);
clearShadow();
}
function drawLineWithShadow(x0, y0, x1, y1)
{
drawShadow();
drawLine(x0, y0, x1, y1);
clearShadow();
}