touching up styling/js

This commit is contained in:
Solomon Laing 2025-04-13 12:38:47 +09:30
parent cd878fffb8
commit 4cee5f089f
3 changed files with 50 additions and 4 deletions

View File

@ -21,14 +21,14 @@
<main> <main>
<section class="accent1 region"> <section class="accent1 region">
<div class="container row"> <div class="container row">
<div class="col"> <div class="col f-row">
<p class="animate-me">Trained in Engineering and IT I spend my time building and maintaining <p class="animate-me">Trained in Engineering and IT I spend my time building and maintaining
software for software for
various companies and organisations. Solving problems is my passion and I strive to get various companies and organisations. Solving problems is my passion and I strive to get
things things
done, and do them well.</p> done, and do them well.</p>
</div> </div>
<div class="col"> <div class="col f-row">
<p class="animate-me"> <p class="animate-me">
I have a penchant for Linux (or GNU/Linux if you prefer) and besides maintaining a I have a penchant for Linux (or GNU/Linux if you prefer) and besides maintaining a
collection of personalisations through scripts and software customisations, I also manage a collection of personalisations through scripts and software customisations, I also manage a
@ -92,7 +92,7 @@
<p class="contact">@inkletblot pretty much everywhere</p> <p class="contact">@inkletblot pretty much everywhere</p>
</div> </div>
</div> </div>
<div class="col center"> <div class="col center top-gap">
<div class="stagger-visualizer"></div> <div class="stagger-visualizer"></div>
</div> </div>
</div> </div>
@ -105,6 +105,7 @@
</footer> </footer>
<script src="https://cdn.jsdelivr.net/npm/animejs@4.0.0/lib/anime.iife.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/animejs@4.0.0/lib/anime.iife.min.js"></script>
<script src="main.js"></script>
<script src="cards.js"></script> <script src="cards.js"></script>
<script src="demo.js"></script> <script src="demo.js"></script>
</body> </body>

36
main.js Normal file
View File

@ -0,0 +1,36 @@
const texts = document.querySelectorAll('.animate-me')
var letterSets = Array.from(texts).map((element) => {
return element.innerText.split(' ');
})
letterSets = letterSets.map((set) => set.map((letter) => letter + '\xa0'))
var letterNodes = [];
for (let i = 0; i < texts.length; i++) {
letterNodes[i] = []
texts[i].textContent = ''
letterSets[i].forEach(letter => {
const letterNode = document.createElement('span');
letterNode.className = 'animate-letter'
// Replace spaces with &nbsp; so it has width after letterizing
letterNode.textContent = letter === " " ? "\xa0" : letter;
texts[i].before(letterNode)
letterNodes[i].push(letterNode);
});
}
texts.forEach((textNode, idx) => {
textNode.parentNode.addEventListener('click', () => {
anime.animate(letterNodes[idx], {
// Property keyframes
y: [
{ to: anime.stagger(['-10rem', '-1rem']), ease: 'outExpo', duration: 150 },
{ to: 0, ease: 'outBounce', duration: 800, delay: 50 }
],
// Property specific parameters
delay: (_, i) => i * 50, // Function based value
ease: 'inOutCirc',
});
})
})

View File

@ -5,6 +5,7 @@
} }
body { body {
overflow-x: hidden;
margin: 0; margin: 0;
font-family: Roboto, sans-serif; font-family: Roboto, sans-serif;
color: #d7d6d4; color: #d7d6d4;
@ -56,7 +57,15 @@ img {
.row { .row {
display: block; display: block;
text-align: justify; }
.f-row {
display: flex;
flex-wrap: wrap;
}
.top-gap {
margin-top: 2rem;
} }
.col:not(:first-child) { .col:not(:first-child) {