Skip to content

Commit

Permalink
feat: add tree animation
Browse files Browse the repository at this point in the history
  • Loading branch information
fritz-benning committed Feb 13, 2023
1 parent fd5c98d commit 93e05bd
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 29 deletions.
14 changes: 14 additions & 0 deletions app/globals.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
body {
height: 100vh;
}

.main {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 100%;
position: relative;
}

.animation {
width: min(72%, 480px);
aspect-ratio: 1 / 1;
}
16 changes: 9 additions & 7 deletions app/layout.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import './globals.css'
import Nav from "@/components/Nav";
import "./globals.css";

export default function RootLayout({ children }) {
return (
<html lang="en">
{/*
<head /> will contain the components returned by the nearest parent
head.js. Find out more at https://beta.nextjs.org/docs/api-reference/file-conventions/head
*/}
<head />
<body>{children}</body>
<body>
<main className="main">
<div className="animation">{children}</div>
<Nav />
</main>
</body>
</html>
)
);
}
10 changes: 1 addition & 9 deletions app/page.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
"use client";
import Rive from "@rive-app/react-canvas";
import styles from "./page.module.css";

export default function RivLab() {
return (
<main className={styles.main}>
<div className={styles.animation}>
<Rive src="animations/party.riv" />
</div>
</main>
);
return <>Hallo</>;
}
13 changes: 0 additions & 13 deletions app/page.module.css

This file was deleted.

7 changes: 7 additions & 0 deletions app/party/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"use client";

import Rive from "@rive-app/react-canvas";

export default function Tree() {
return <Rive src="animations/party.riv" />;
}
7 changes: 7 additions & 0 deletions app/tree/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"use client";

import Rive from "@rive-app/react-canvas";

export default function Tree() {
return <Rive src="animations/tree.riv" stateMachines="flow" />;
}
22 changes: 22 additions & 0 deletions components/Nav/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"use client";
import Link from "next/link";
import styles from "./styles.module.css";

export default function Nav() {
return (
<nav className={styles.navigation}>
<ul className={styles.list}>
<li className={styles.item}>
<Link href="/party" className={styles.link} activeStyle={{ color: "#000" }}>
Party
</Link>
</li>
<li className={styles.item}>
<Link href="/tree" className={styles.link} activeStyle={{ color: "#000" }}>
Tree
</Link>
</li>
</ul>
</nav>
);
}
24 changes: 24 additions & 0 deletions components/Nav/styles.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.navigation {
position: absolute;
bottom: 10vh;
left: 50%;
transform: translate(-50%, 0);
}

.list {
list-style-type: none;
display: flex;
margin: 0;
padding: 0;
}

.item {
font-family: sans-serif;
font-size: 1.2rem;
padding: 0 2rem;
}

.link {
text-decoration: none;
color: #cccccc;
}
Binary file added public/animations/tree.riv
Binary file not shown.

1 comment on commit 93e05bd

@vercel
Copy link

@vercel vercel bot commented on 93e05bd Feb 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

rive-lab – ./

rive-lab.vercel.app
rive-lab-neoskop.vercel.app
rive-lab-git-master-neoskop.vercel.app

Please sign in to comment.