-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
135 lines (118 loc) · 3.22 KB
/
index.js
File metadata and controls
135 lines (118 loc) · 3.22 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
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
window.onload=()=>{
let $,
//selecting the slider element
slider = document.getElementById('slide'),
//setting a factorValue
factorValue = 1,
//Declaring a font family
fontFamily = "Bold 65px 'Gill Sans Ultra Bold', sans-serif";
//Inintializing the canvas
_();
function _(){
$ = document.getElementById("canvas").getContext("2d");
//Setting the font family
$.font = fontFamily;
//Saving the context
$.save();
//Calling the draw function
drawLogo();
}
///function for scaling the shield
function scaleLogo(num){
//setting the factor value
factorValue = num / 100;
//calling the draw function
drawLogo();
}
//function for initializing the shield
function drawLogo(){
//giving an offset to the shield
var offsetY = 80;
//Recall the saved context
$.restore();
//saving the context
$.save();
//clearing the canvas
$.clearRect(0, 0, 280, 400);
//scaling the canvas
$.scale(factorValue, factorValue);
//Drawing the text
$.fillText("CSS", 75,60);
$
$.translate(0, offsetY);
//Setting a color value of the shield
$.fillStyle = '#264DE4';
//Start the shape drawing
$.beginPath();
//Drawing the shield
$.moveTo(39,250);
$.lineTo(17,0);
$.lineTo(262,0);
$.lineTo(239,250);
$.lineTo(139,278);
$.closePath();
//Filling the shape with the color
$.fill();
//calling a font family
$.font = fontFamily;
//The lighter half of the shield
$.fillStyle = '#2965F1';
$.beginPath();
$.moveTo(139,257);
$.lineTo(220,234);
$.lineTo(239,20);
$.lineTo(139,20);
$.closePath();
$.fill();
//first part of the 3
$.fillStyle = '#EBEBEB';
$.beginPath();
$.moveTo(139,82);
$.lineTo(139,51);
$.lineTo(62,51);
$.lineTo(64,82);
$.closePath();
$.fill();
//second part of the 3
$.beginPath();
$.moveTo(139,144);
$.lineTo(139,113);
$.lineTo(99,113);
$.lineTo(101,144);
$.closePath();
$.fill();
//third cut of first half
$.beginPath();
$.moveTo(139,193);
$.lineTo(105,184);
$.lineTo(103,159);
$.lineTo(72,159);
$.lineTo(76,207);
$.lineTo(139,225);
$.closePath();
$.fill();
//second half of the five
$.fillStyle = '#FFFFFF';
$.beginPath();
$.moveTo(139,51);
$.lineTo(139,82);
$.lineTo(182,82);
$.lineTo(179,113);
$.lineTo(139,113);
$.lineTo(139,144);
$.lineTo(177,144);
$.lineTo(173,184);
$.lineTo(139,193);
$.lineTo(139,225);
$.lineTo(202,207);
$.lineTo(216,51);
$.closePath();
$.fill();
}
//adding the event listener for the slider
slider.addEventListener('input', function(){
//calling the scale function
scaleLogo(slider.value);
//console.log(slider.value);
});
}