-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
205 lines (183 loc) · 5.08 KB
/
index.js
File metadata and controls
205 lines (183 loc) · 5.08 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
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
var TxtType = function(el, toRotate, period) {
this.toRotate = toRotate;
this.el = el;
this.loopNum = 0;
this.period = parseInt(period, 10) || 2000;
this.txt = '';
this.tick();
this.isDeleting = false;
};
TxtType.prototype.tick = function() {
var i = this.loopNum % this.toRotate.length;
var fullTxt = this.toRotate[i];
if (this.isDeleting) {
this.txt = fullTxt.substring(0, this.txt.length - 1);
} else {
this.txt = fullTxt.substring(0, this.txt.length + 1);
}
this.el.innerHTML = '<span class="wrap">' + this.txt + '</span>';
var that = this;
var delta = 200 - Math.random() * 100;
if (this.isDeleting) { delta /= 2; }
if (!this.isDeleting && this.txt === fullTxt) {
delta = this.period;
this.isDeleting = true;
} else if (this.isDeleting && this.txt === '') {
this.isDeleting = false;
this.loopNum++;
delta = 500;
}
setTimeout(function() {
that.tick();
}, delta);
};
window.onload = function() {
var elements = document.getElementsByClassName('typewrite');
for (var i = 0; i < elements.length; i++) {
var toRotate = elements[i].getAttribute('data-type');
var period = elements[i].getAttribute('data-period');
if (toRotate) {
new TxtType(elements[i], JSON.parse(toRotate), period);
}
}
// INJECT CSS
var css = document.createElement("style");
css.type = "text/css";
css.innerHTML = ".typewrite > .wrap { border-right: 0.08em solid #fff}";
document.body.appendChild(css);
};
function complete() {
clearInterval(timer);
timer = null;
}
// skills
var skills = [
{"header" : "INTERESTS",
"captions" : [
"Software Development",
"CI/CD",
"Web",
"Machine Learning",
"AI"
],
"values" : [
0.80,
0.90,
0.70,
0.80,
0.90
]
},
{"header" : "LANGUAGES",
"captions" : [
"Python",
"PhP",
"Java",
"Javascript",
"c++"
],
"values" : [
0.90,
0.70,
0.90,
0.70,
0.80
]
},
{"header" : "FRAMEWORKS AND DATABASES",
"captions" : [
"Django",
"Nodejs",
"React",
"MongoDb",
"Mysql"
],
"values" : [
0.80,
0.85,
0.90,
0.75,
0.60
]
}
];
var pentagonIndex = 0;
var valueIndex = 0;
var width = 0;
var height = 0;
var radOffset = Math.PI/2
var sides = 5; // Number of sides in the polygon
var theta = 2 * Math.PI/sides; // radians per section
function getXY(i, radius) {
return {"x": Math.cos(radOffset +theta * i) * radius*width + width/2,
"y": Math.sin(radOffset +theta * i) * radius*height + height/2};
}
var hue = [];
var hueOffset = 35;
for (var s in skills) {
$(".skills").append('<div class="pentagon col-lg-4 col-md-4 col-sm-6 col-12" id="interests"><div class="header"></div><canvas width="294" height="269" class="pentCanvas" /></div>');
hue[s] = (hueOffset + s * 255/skills.length) % 255;
}
$(".pentagon").each(function(index){
width = $(this).width();
height = $(this).height();
var ctx = $(this).find('canvas')[0].getContext('2d');
ctx.canvas.width = width;
ctx.canvas.height = height;
ctx.font="15px Monospace";
ctx.textAlign="center";
/*** LABEL ***/
color = "hsl("+hue[pentagonIndex]+", 100%, 30%)";
ctx.fillStyle = color;
ctx.fillText(skills[pentagonIndex].header, width/2, 15);
ctx.font="13px Monospace";
/*** PENTAGON BACKGROUND ***/
for (var i = 0; i < sides; i++) {
// For each side, draw two segments: the side, and the radius
ctx.beginPath();
xy = getXY(i, 0.3);
colorJitter = 25 + theta*i*2;
color = "hsl("+hue[pentagonIndex]+",100%," + colorJitter + "%)";
ctx.fillStyle = color;
ctx.strokeStyle = color;
ctx.moveTo(0.5*width, 0.5*height); //center
ctx.lineTo(xy.x, xy.y);
xy = getXY(i+1, 0.3);
ctx.lineTo(xy.x, xy.y);
xy = getXY(i, 0.37);
console.log();
ctx.fillText(skills[ pentagonIndex].captions[valueIndex],xy.x, xy.y +5);
valueIndex++;
ctx.closePath();
ctx.fill();
ctx.stroke();
}
valueIndex = 0;
ctx.beginPath();
ctx.fillStyle = "rgba(0, 0, 0, 0.2)";
ctx.strokeStyle = "rgba(0, 0, 0, 0.3)";
ctx.lineWidth = 5;
var value = skills[pentagonIndex].values[valueIndex];
xy = getXY(i, value * 0.3);
ctx.moveTo(xy.x,xy.y);
/*** SKILL GRAPH ***/
for (var i = 0; i < sides; i++) {
xy = getXY(i, value * 0.3);
ctx.lineTo(xy.x,xy.y);
valueIndex++;
value = skills[pentagonIndex].values[valueIndex];
}
ctx.closePath();
ctx.stroke();
ctx.fill();
valueIndex = 0;
pentagonIndex++;
});
$(".nav .nav-link").on("click", function(){
$(".nav").find(".active").removeClass("active");
$(this).addClass("active");
});
function thanks(){
$(".contact").css("display","none");
$(".contact2").css("display","block");
}