feat(Style): add animations and effects to landing page
added: - float like group - button hover effect - link hover glow effect - component zoom effect
This commit is contained in:
parent
9f15e40d6e
commit
d7a9817514
5 changed files with 92 additions and 7 deletions
|
|
@ -0,0 +1,60 @@
|
|||
@use './mixins';
|
||||
|
||||
@include mixins.responsive using ($screen-size) {
|
||||
.anim-#{$screen-size}-none {
|
||||
animation: none !important;
|
||||
}
|
||||
|
||||
.anim-group-#{$screen-size}-none > * {
|
||||
animation: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes hover {
|
||||
from {
|
||||
transform: translate(0, 0);
|
||||
}
|
||||
to {
|
||||
transform: translate(0, var(--anim-translation-value));
|
||||
}
|
||||
}
|
||||
|
||||
$anim-base-offset: -1s;
|
||||
|
||||
.anim-idle-hover {
|
||||
--anim-translation-value: var(--prj-spacing-1);
|
||||
--anim-offset: 0s;
|
||||
animation: hover 1.5s ease-in-out var(--anim-offset) infinite alternate;
|
||||
}
|
||||
|
||||
.anim-idle-hover-group {
|
||||
& > * {
|
||||
@extend .anim-idle-hover;
|
||||
}
|
||||
|
||||
@for $index from 1 through 20 {
|
||||
$anim-offset: $anim-base-offset * $index;
|
||||
& > :nth-child(#{$index}n) {
|
||||
--anim-offset: #{$anim-offset};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.anim-hover-zoom {
|
||||
transition: scale 0.2s;
|
||||
&:hover {
|
||||
scale: 1.05;
|
||||
}
|
||||
}
|
||||
|
||||
.anim-hover-translate {
|
||||
--anim-translation-value: -5px;
|
||||
--anim-shadow-color: var(--prj-accent-bg);
|
||||
transition: translate 0.2s;
|
||||
|
||||
&:hover {
|
||||
translate: var(--anim-translation-value) var(--anim-translation-value);
|
||||
box-shadow: calc(var(--anim-translation-value) * -1)
|
||||
calc(var(--anim-translation-value) * -1) 0px 0px var(--anim-shadow-color);
|
||||
}
|
||||
}
|
||||
|
|
@ -144,3 +144,12 @@ li:not(:last-child) {
|
|||
|
||||
padding: var(--prj-spacing-3);
|
||||
}
|
||||
|
||||
a {
|
||||
transition: text-shadow 0.2s;
|
||||
--anim-shadow-color: var(--prj-accent-bg);
|
||||
|
||||
&:hover {
|
||||
text-shadow: 1px 1px 8px var(--anim-shadow-color);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ const { className = '' } = Astro.props;
|
|||
<slot />
|
||||
</button>
|
||||
|
||||
<style>
|
||||
<style lang="scss">
|
||||
button {
|
||||
font-size: 1rem;
|
||||
padding: var(--prj-spacing-1) var(--prj-spacing-3);
|
||||
|
|
@ -23,5 +23,18 @@ const { className = '' } = Astro.props;
|
|||
cursor: pointer;
|
||||
|
||||
margin-bottom: 0;
|
||||
box-shadow: 0 0 0px 0px var(--prj-accent-bg);
|
||||
|
||||
transition: color 0.2s, background-color 0.2s, translate 0.2s,
|
||||
box-shadow 0.2s;
|
||||
|
||||
&:hover {
|
||||
--anim-translation-value: -5px;
|
||||
background-color: transparent;
|
||||
color: var(--prj-text);
|
||||
translate: var(--anim-translation-value) var(--anim-translation-value);
|
||||
box-shadow: calc(var(--anim-translation-value) * -2)
|
||||
calc(var(--anim-translation-value) * -2) 0px 0px var(--prj-accent-bg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
---
|
||||
export interface Props {
|
||||
title?: string;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const { className } = Astro.props;
|
||||
---
|
||||
|
||||
<div class="card vstack">
|
||||
<div class:list={['card', 'vstack', className]}>
|
||||
<div class="title">
|
||||
<slot name="title" />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ const portafolio = await getCollection('portafolio', ({ data }) =>
|
|||
<h2 class="text-center">Featured Work</h2>
|
||||
|
||||
<div class="grid grid-cols-1 grid-lg-cols-3 gap-4">
|
||||
<Card>
|
||||
<Card className="anim-hover-zoom">
|
||||
<img
|
||||
src="https://placehold.co/600x400"
|
||||
alt="project img"
|
||||
|
|
@ -63,7 +63,7 @@ const portafolio = await getCollection('portafolio', ({ data }) =>
|
|||
</div>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<Card className="anim-hover-zoom">
|
||||
<img
|
||||
src="https://placehold.co/600x400"
|
||||
alt="project img"
|
||||
|
|
@ -80,7 +80,7 @@ const portafolio = await getCollection('portafolio', ({ data }) =>
|
|||
</div>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<Card className="anim-hover-zoom">
|
||||
<img
|
||||
src="https://placehold.co/600x400"
|
||||
alt="project img"
|
||||
|
|
@ -231,7 +231,7 @@ const portafolio = await getCollection('portafolio', ({ data }) =>
|
|||
|
||||
<div class="vstack justify-content-center">
|
||||
<ul
|
||||
class="list-unstyle fs-5 ml-lg-5 mt-3 d-flex d-lg-block justify-content-around"
|
||||
class="list-unstyle fs-5 ml-lg-5 mt-3 d-flex d-lg-block justify-content-around anim-idle-hover-group anim-group-lg-none"
|
||||
>
|
||||
{
|
||||
[
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue