Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
naixy28 committed Nov 29, 2022
1 parent de0081f commit e461d29
Show file tree
Hide file tree
Showing 9 changed files with 494 additions and 221 deletions.
36 changes: 5 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,8 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
# Star Warp Effect

## Getting Started
Several approaches to make a star warp effect.

First, run the development server:
## Routes

```bash
npm run dev
# or
yarn dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.

[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.

The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
- `/` pure webgl
- `/interactive` canvas 2d, fake perspective projection
33 changes: 33 additions & 0 deletions components/Routes.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { FC, useEffect } from "react";
import { useRouter } from "next/router";
import cls from "classnames";

const routeConfig = {
"/": "Webgl / Interactive",
"/interactive": "Canvas 2D / Interactive / Fake Perspective Projection",
};

export const Routes: FC = () => {
const router = useRouter();
console.log(router.pathname);
const pathname = router.pathname;

return (
<div className="fixed bottom-4 left-4">
<div className="text-white hover:cursor-pointer font-medium font-mono ">
{Object.entries(routeConfig).map(([key, val]) => (
<div
className={cls(
'before:content-[">"] before:mr-2 mt-3 opacity-70 hover:opacity-100 transition-opacity leading-5',
pathname === key ? "opacity-100" : ""
)}
key={key}
onClick={() => router.push(key)}
>
{val}
</div>
))}
</div>
</div>
);
};
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "star-effect",
"name": "star-warp-effect",
"version": "0.1.0",
"private": true,
"scripts": {
Expand All @@ -12,11 +12,17 @@
"@types/node": "18.11.9",
"@types/react": "18.0.25",
"@types/react-dom": "18.0.9",
"classnames": "^2.3.2",
"eslint": "8.28.0",
"eslint-config-next": "13.0.5",
"next": "13.0.5",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "4.9.3"
},
"devDependencies": {
"autoprefixer": "^10.4.13",
"postcss": "^8.4.19",
"tailwindcss": "^3.2.4"
}
}
12 changes: 9 additions & 3 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import '../styles/globals.css'
import type { AppProps } from 'next/app'
import "../styles/globals.css";
import type { AppProps } from "next/app";
import { Routes } from "../components/Routes";

export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
return (
<>
<Component {...pageProps} />
<Routes />
</>
);
}
Loading

1 comment on commit e461d29

@vercel
Copy link

@vercel vercel bot commented on e461d29 Nov 29, 2022

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:

start-warp-effect – ./

start-warp-effect-git-main-naixy28.vercel.app
start-warp-effect-naixy28.vercel.app
start-warp-effect.vercel.app

Please sign in to comment.