|
|
@ -8,8 +8,17 @@
|
|
|
|
// set a global var "run" to true before running this function
|
|
|
|
// set a global var "run" to true before running this function
|
|
|
|
"use strict";
|
|
|
|
"use strict";
|
|
|
|
async function flyingText(canvas) {
|
|
|
|
async function flyingText(canvas) {
|
|
|
|
|
|
|
|
canvas.classList.remove("hidden");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (runTextAnimation) {
|
|
|
|
|
|
|
|
// wait till ele is rdy in dom + time between spawns
|
|
|
|
|
|
|
|
await shootText(canvas, 4);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function shootText(canvas, sec, sta) {
|
|
|
|
// TODO: move to argument, load from backend
|
|
|
|
// TODO: move to argument, load from backend
|
|
|
|
let statements = ["Keyboard-Nerd", "🖤", "Emacs",
|
|
|
|
let statements = sta || ["Keyboard-Nerd", "🖤", "Emacs",
|
|
|
|
"Lives in VI", "GNU/Linux", "Arch Linux",
|
|
|
|
"Lives in VI", "GNU/Linux", "Arch Linux",
|
|
|
|
"Computer Science", "Design",
|
|
|
|
"Computer Science", "Design",
|
|
|
|
"Javascript", "C/C++", "Go", "Bash",
|
|
|
|
"Javascript", "C/C++", "Go", "Bash",
|
|
|
@ -28,12 +37,8 @@ async function flyingText(canvas) {
|
|
|
|
"Winter is coming!", "😺 Person"];
|
|
|
|
"Winter is coming!", "😺 Person"];
|
|
|
|
|
|
|
|
|
|
|
|
let stCount = statements.length;
|
|
|
|
let stCount = statements.length;
|
|
|
|
let animationTime = 4;
|
|
|
|
let animationTime = sec;
|
|
|
|
let maxX , maxY, x, y;
|
|
|
|
let maxX , maxY, x, y;
|
|
|
|
|
|
|
|
|
|
|
|
canvas.classList.remove("hidden");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (runTextAnimation) {
|
|
|
|
|
|
|
|
// Browser resize
|
|
|
|
// Browser resize
|
|
|
|
maxX = canvas.offsetWidth / 2;
|
|
|
|
maxX = canvas.offsetWidth / 2;
|
|
|
|
maxY = canvas.offsetHeight / 2;
|
|
|
|
maxY = canvas.offsetHeight / 2;
|
|
|
@ -52,8 +57,6 @@ async function flyingText(canvas) {
|
|
|
|
y = (getRand(2) == 1) ? -1*y : 0.8 * y;
|
|
|
|
y = (getRand(2) == 1) ? -1*y : 0.8 * y;
|
|
|
|
|
|
|
|
|
|
|
|
canvas.appendChild(curr);
|
|
|
|
canvas.appendChild(curr);
|
|
|
|
|
|
|
|
|
|
|
|
// wait till ele is rdy in dom + time between spawns
|
|
|
|
|
|
|
|
await sleep(1000);
|
|
|
|
await sleep(1000);
|
|
|
|
|
|
|
|
|
|
|
|
// add the stuff that should be animated (transition in class)
|
|
|
|
// add the stuff that should be animated (transition in class)
|
|
|
@ -65,7 +68,6 @@ async function flyingText(canvas) {
|
|
|
|
curr.remove();
|
|
|
|
curr.remove();
|
|
|
|
}, animationTime * 1000 + 2000);
|
|
|
|
}, animationTime * 1000 + 2000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getRand(max, min) {
|
|
|
|
function getRand(max, min) {
|
|
|
|
min = min || 0;
|
|
|
|
min = min || 0;
|
|
|
|