1
0

Continue work on hero and layout, implement hover effect

This commit is contained in:
Michael Rieger
2025-09-15 17:07:08 +02:00
parent b5e812da0f
commit 5967768c25
8 changed files with 224 additions and 51 deletions
+73
View File
@@ -0,0 +1,73 @@
<div class="cursor">
<div class="ball ball--small">
<svg height="10" width="10">
<circle cx="5" cy="5" r="4" stroke-width="0"></circle>
</svg>
</div>
<div class="ball ball--big">
<svg height="30" width="30">
<circle cx="15" cy="15" r="12" stroke-width="0"></circle>
</svg>
</div>
</div>
<script>
import { gsap } from "gsap";
const smallBall = document.querySelector(".cursor > .ball--small");
const bigBall = document.querySelector(".cursor >.ball--big");
const hoverables = document.querySelectorAll(".hoverable");
// Listeners
document.body.addEventListener("mousemove", onMouseMove);
for (let i = 0; i < hoverables.length; i++) {
hoverables[i].addEventListener("mouseenter", onMouseHover);
hoverables[i].addEventListener("mouseleave", onMouseHoverOut);
}
// Move the cursor
function onMouseMove(event: MouseEvent) {
gsap.to(bigBall, {
duration: 0.4,
y: event.pageY - 15,
x: event.pageX - 15,
});
gsap.to(smallBall, {
duration: 0.1,
x: event.pageX - 5,
y: event.pageY - 7,
});
}
// Hover an element
function onMouseHover() {
gsap.to(bigBall, {
duration: 0.3,
scale: 5,
});
}
function onMouseHoverOut() {
gsap.to(bigBall, {
duration: 0.3,
scale: 1,
});
}
</script>
<style>
.cursor {
pointer-events: none;
}
.ball {
position: fixed;
top: 0;
left: 0;
mix-blend-mode: difference;
/* z-index: -1; */
& circle {
fill: var(--clr-ts-warm-red);
}
}
</style>
+45 -36
View File
@@ -1,45 +1,54 @@
<style is:global>
@import url('../styles/archivo.css');
@import url('../styles/clash-display.css');
@import url("../styles/archivo.css");
@import url("../styles/clash-display.css");
:root {
--clr-ts-warm-red: hsl(3, 94%, 60%);
--clr-ts-dark: hsl(7, 18%, 10%);
--clr-ts-dark-logo: hsl(7, 18%, 13%);
--clr-ts-light: hsl(349, 57%, 91%);
:root {
--clr-ts-warm-red: hsl(3, 94%, 60%);
--clr-ts-dark: hsl(7, 18%, 10%);
--clr-ts-dark-logo: hsl(7, 18%, 13%);
--clr-ts-light: hsl(349, 57%, 91%);
--ff-heading: "Clash Display", sans-serif;
--ff-body: "Archivo", sans-serif;
--ff-heading: "Clash Display", sans-serif;
--ff-body: "Archivo", sans-serif;
--fs-xl: clamp(3.75rem, 5vw + 1rem, 6rem);
--fs-600: 1.5rem;
--fs-500: 1.25rem;
--fs-400: 1rem;
}
--fs-xl: clamp(3rem, 4vw + 1rem, 6rem);
--fs-600: 1.25rem;
--fs-500: 1.125rem;
--fs-400: 1rem;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html,
body {
margin: 0;
width: 100%;
height: 100%;
}
body {
width: 100%;
height: 100%;
margin: 0;
overflow: clip;
body {
background-color: var(--clr-ts-dark);
color: var(--clr-ts-light);
font-family: var(--ff-body);
font-size: var(--fs-400);
padding: clamp(2rem, 5vw + 1rem, 3.75rem);
}
padding: clamp(2rem, 5vw + 1rem, 3.75rem);
h1 {
font-family: var(--ff-heading);
font-size: var(--fs-xl);
}
font-family: var(--ff-body);
font-size: var(--fs-400);
background-color: var(--clr-ts-dark);
color: var(--clr-ts-light);
}
.sr-only {
position: absolute !important;
overflow: hidden !important;
white-space: nowrap !important;
width: 1px !important;
height: 1px !important;
margin: -1px !important;
padding: 0 !important;
border: 0 !important;
clip: rect(1px 1px 1px 1px) !important;
-webkit-clip-path: inset(50%) !important;
clip-path: inset(50%) !important;
}
</style>
+6 -6
View File
@@ -7,26 +7,27 @@ const isEnglish = Astro.currentLocale === "en";
---
<header>
<div>
<a href="." class="hoverable hoverable--diff">
<span class="sr-only">Back to home</span>
<Image
class="icon"
src={logo}
loading="eager"
alt="Tideshift Digital logo mark"
/>
</div>
</a>
<nav>
<ul>
<li>
<a
class:list={[{ active: isEnglish }]}
class:list={['hoverable', { active: isEnglish }]}
href={getRelativeLocaleUrl("en", "")}>EN</a
>
</li>
<li>
<a
class:list={[{ active: !isEnglish }]}
class:list={['hoverable',{ active: !isEnglish }]}
href={getRelativeLocaleUrl("de", "")}>DE</a
>
</li>
@@ -38,7 +39,6 @@ const isEnglish = Astro.currentLocale === "en";
header {
display: flex;
justify-content: space-between;
border: 1px solid var(--clr-ts-warm-red);
}
.icon {
@@ -53,7 +53,7 @@ const isEnglish = Astro.currentLocale === "en";
}
ul {
a {
& a {
color: var(--clr-ts-light);
text-decoration: none;
+82 -9
View File
@@ -3,24 +3,55 @@ import { Image } from "astro:assets";
import Logo from "../assets/ci/icon-only.svg";
---
<div>
<div>
<h1 class="title">Smart websites for bold ideas.</h1>
<div class="wrapper">
<div class="inner">
<div class="content">
<h1>Smart websites for bold ideas.</h1>
<p>
From concept to launch — websites, apps, and digital solutions that
work hard, so you can play hard. Whether it's a personal site, an
e-commerce platform, or a custom web app, I bring your ideas to
life.
</p>
<p>
From concept to launch — websites, apps, and digital solutions
that work hard, so you can play hard. Whether it's a personal
site, an e-commerce platform, or a custom web app, I bring your
ideas to life.
</p>
<a href="mailto:hello@tideshiftdigital.com?subject=Anfrage" class="hoverable">Get in touch</a>
</div>
<div class="typemark">Tideshift</div>
</div>
<Logo class="logo" />
</div>
<style>
.wrapper {
display: block;
height: 100%;
width: 100%;
overflow: clip;
}
.inner {
display: grid;
height: 100%;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr;
}
.content {
display: flex;
flex-direction: column;
justify-content: center;
gap: 2em;
grid-column: 1 / -1;
grid-row: 1 / -1;
}
h1 {
max-width: 16ch;
font-family: var(--ff-heading);
font-size: var(--fs-xl);
font-weight: 700;
text-transform: uppercase;
line-height: 1.1;
@@ -30,9 +61,51 @@ import Logo from "../assets/ci/icon-only.svg";
p {
max-width: 50ch;
line-height: 1.4;
font-size: var(--fs-600);
}
a {
display: inline-block;
width: max-content;
text-decoration: none;
position: relative;
font-size: var(--fs-600);
font-weight: 600;
color: var(--clr-ts-light);
}
a:after {
content: "";
display: block;
width: 100%;
height: 2px;
background-color: var(--clr-ts-warm-red);
position: absolute;
left: 0;
bottom: 0;
}
.typemark {
margin: auto 0 0 auto;
grid-row: 2;
grid-column: 2;
font-family: var(--ff-heading);
text-transform: uppercase;
font-weight: 600;
font-size: 3.125rem;
letter-spacing: 0.03em;
color: var(--clr-ts-warm-red);
}
.logo {
width: auto;
margin-left: auto;
height: 95vh;
fill: var(--clr-ts-dark-logo) !important;
z-index: -10;
position: absolute;
right: 0;
bottom: 0;
transform: translate3d(10vw, 10vh, 0);
}
</style>