Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animation et accueil v2 #151

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 118 additions & 0 deletions web/app/AnimatedIllustrastion.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
'use client'

import css from '@/css/convertToJs'

const duration = '3000ms'

export default function AnimatedIllustration({
d = 'M 256,100 C 14,80 13,80 14,120',
invert,
}) {
return (
<div
css={`
z-index: -1;
width: 200px;
height: 100px;
position: absolute;
top: 50%;
left: 50%;
transform:
translateX(-50%) translateY(-50%);
opacity: .6;
> img {
opacity: 0.8;
position: absolute;
top: -1rem;
left: -1rem;
offset-path: path('${d}');
animation: move ${duration};
animation-fill-mode: both;
animation-delay: ${!invert ? '300ms' : '0s'};
@keyframes move {
0% {
opacity: 0
offset-distance: 0%;
}
10 % {
opacity: 1;
}
30% {
filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.6));
}
70% {
filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.1));
}
90% {
offset-distance: 100%;
opacity: 1
}
100% {
offset-distance: 100%;
opacity: 0
}
}
}
svg {
position: absolute;
top: 0;
left: 0;
width: 200px;
height: 100px;
}
path {
stroke-dasharray: 230;
stroke-dashoffset: 230;
opacity: 0;
animation: draw ${duration};
animation-fill-mode: both;
}

@keyframes draw {
0% {
opacity: 0;
stroke-dashoffset: 230;
stroke: red;
}
30% {
stroke: red;
opacity: 1;
}
90% {
stroke-dashoffset: 10;
stroke: #000094;
opacity: 1
}
100%{
stroke-dashoffset: 10;

stroke: #000094;
opacity: 0;
}
}
`}
>
<svg viewBox="10 10 200 100">
<path
d={d}
style={css`
fill: none;
stroke-width: 2px;
`}
/>
</svg>
<Cyclist invert={invert} />
</div>
)
}

const Cyclist = ({ invert }) => (
<img
src="/cyclist.svg"
css={`
width: 2rem !important;
height: auto !important;
transform: scaleX(-1) ${!invert && `scaleY(-1)`};
`}
></img>
)
1 change: 1 addition & 0 deletions web/app/UI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const Cards = styled.div`
flex-wrap: wrap;
`
export const Header = styled.header`
position: relative;
display: flex;
align-items: center;
justify-content: center;
Expand Down
11 changes: 11 additions & 0 deletions web/app/animation.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions web/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Cards, LandingWrapper, Header, Card, LinkCard } from './UI'
import type { Metadata } from 'next'
import Image from 'next/image'
import logo from '@/public/logo.svg'
import AnimatedIllustration from './AnimatedIllustrastion'

export const metadata: Metadata = {
title:
Expand All @@ -13,6 +14,8 @@ export const metadata: Metadata = {
export default () => (
<LandingWrapper>
<Header>
<AnimatedIllustration />
<AnimatedIllustration d="M -6,42 C 187,42 187,42 187,4" invert={true} />
<Image src={logo} alt="Logo de villes.plus" />
<h1>Villes.plus</h1>
</Header>
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"eslint": "8.37.0",
"eslint-config-next": "13.2.4",
"leaflet": "^1.9.3",
"next": "^13.5.3",
"next": "^14.0.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-leaflet": "^4.2.1",
Expand Down
121 changes: 121 additions & 0 deletions web/public/cyclist.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading