Started base work on backend for timeline automation and also updated gulpfile.js to add a new task for deploying via ftp to host.

This commit is contained in:
2021-08-21 12:26:31 +01:00
parent 7d901093bf
commit fba01f1d98
9 changed files with 1029 additions and 64 deletions
+2 -1
View File
@@ -310,7 +310,6 @@ section#curriculumvitae .cvGrid > div {
#curriculumvitae .timelineItem span {
color: hsl(0, 0%, 90%);
}
/**** Media Queries *****/
@media screen and (max-width: 90em) {
@@ -340,6 +339,7 @@ section#curriculumvitae .cvGrid > div {
section#curriculumvitae .cvGrid .timeline {
margin: 0 auto;
}
}
@media screen and (max-width: 75em) {
@@ -520,6 +520,7 @@ section#curriculumvitae .cvGrid > div {
section#about div {
padding: 0.1em 2.5em;
}
}
@media screen and (max-width: 31em) {
+1 -1
View File
@@ -5,7 +5,7 @@
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<title>Rohit Pai - Portfolio</title>
<link rel="stylesheet" href="css/main.css">
<script src="https://kit.fontawesome.com/ed3c25598e.js" crossorigin="anonymous"></script>
<script src="js/main.js"></script>
+77 -49
View File
@@ -1,5 +1,9 @@
// scrolling effect
const scrollLimit = 150;
// array with texts to type in typewriter
var dataText = ["full stack developer", "web designer", "student", "gamer", "drummer"];
window.onscroll = () =>
{
// check if scrolled past limit if so add scrolled class to change background of nav
@@ -39,57 +43,81 @@ window.onscroll = () =>
});
};
// typewriter effect
/**
* typeWriter function
* type one character at a time in the typewriter
* keeps calling itself until the text is finished
* @param {string} text text to type
* @param {number} i current index at which the next character should be typed
* @param {function} fnCallback function to call back in this case the StartTextAnimation function
*/
function typeWriter(text, i, fnCallback)
{
// check if text isn't finished yet
if (i < (text.length))
{
// add next character to h1
document.querySelector("header div h1").innerHTML = text.substring(0, i + 1) + "<span aria-hidden=\"true\">_</span>";
// wait for a while and call this function again for next character
setTimeout(function ()
{
typeWriter(text, i + 1, fnCallback)
}, 100);
}
// text finished, call callback if there is a callback function
else if (typeof fnCallback == "function")
{
// call callback after timeout
setTimeout(fnCallback, 700);
}
}
/**
* StartTextAnimation function
* start a typewriter animation for a text in the dataText array
* @param {number} i current index at which text should be typed next
*/
function StartTextAnimation(i)
{
if (typeof dataText[i] === "undefined")
{
setTimeout(function ()
{
StartTextAnimation(0);
}, 1500);
}
else if (i < dataText[i].length)
{
// text exists! start typewriter animation
typeWriter(dataText[i], 0, function ()
{
// after callback (and whole text has been animated), start next text
setTimeout(StartTextAnimation, 1500, i + 1);
});
}
}
// cv timeline data
function getTimelineData()
{
fetch("/api/timelineData").then(res =>
{
res.json().then(json =>
{
console.log(JSON.parse(json));
})
});
}
document.addEventListener('DOMContentLoaded', () =>
{
// array with texts to type in typewriter
var dataText = ["full stack developer", "web designer", "student", "gamer", "drummer"];
// type one text in the typwriter
// keeps calling itself until the text is finished
function typeWriter(text, i, fnCallback)
{
// chekc if text isn't finished yet
if (i < (text.length))
{
// add next character to h1
document.querySelector("header div h1").innerHTML = text.substring(0, i + 1) + "<span aria-hidden=\"true\">_</span>";
// wait for a while and call this function again for next character
setTimeout(function ()
{
typeWriter(text, i + 1, fnCallback)
}, 100);
}
// text finished, call callback if there is a callback function
else if (typeof fnCallback == "function")
{
// call callback after timeout
setTimeout(fnCallback, 700);
}
}
// start a typewriter animation for a text in the dataText array
function StartTextAnimation(i)
{
if (typeof dataText[i] === "undefined")
{
setTimeout(function ()
{
StartTextAnimation(0);
}, 1500);
}
else if (i < dataText[i].length)
{
// text exists! start typewriter animation
typeWriter(dataText[i], 0, function ()
{
// after callback (and whole text has been animated), start next text
setTimeout(StartTextAnimation, 1500, i + 1);
});
}
}
// start the text animation
StartTextAnimation(0);
});
// get timeline data and add it to the timeline
//getTimelineData();
});