aboutsummaryrefslogtreecommitdiff
path: root/projects/about/public/tabAnimation.js
blob: f0040d0e5c7b98bfc5ad1e3761aaa84e9e48c24f (plain)
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
// animated tab
const animation = [
  {
    emoji: "🌍",
    title: "AROUND the world",
  },
  {
    emoji: "🌏",
    title: "around THE world",
  },
  {
    emoji: "🌎",
    title: "around the WORLD",
  },
];

let tabAnimationStep = 0;
const favicon = document.querySelector("link[rel='icon']");
const updateTab = () => {
  const currentAnimation = animation[tabAnimationStep % animation.length];
  favicon.href = `data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y=".9em" font-size="90">${currentAnimation.emoji}</text></svg>`;
  document.title = currentAnimation.title;
  tabAnimationStep++;
  setTimeout(updateTab, 1000);
};

updateTab();