145 |
171 | {/*
{JSON.stringify(state, null, 4)}
*/}
172 | {/*
{JSON.stringify(chartData, null, 4)}
*/}
173 |
174 |
175 | Framer Motion Visualizer
176 |
177 |
178 | Visualize Framer Motion Animations
179 |
180 | Made by{' '}
181 |
185 | @__morse
186 |
187 |
188 |
189 |
190 |
191 |
195 | x.toFixed(0) + 'px'}
203 | yAxisWidth='w-12'
204 | showAnimation={false}
205 | height='h-60'
206 | startEndOnly={!!chartData.length}
207 | // showXAxis={false}
208 | // showGridLines={false}
209 | />
210 |
211 | {/* {
215 | setLoaded(true)
216 | }}
217 | controls
218 | playsInline
219 | autoPlay
220 | muted
221 | loop
222 | /> */}
223 |
224 |
225 |
226 | {
228 | setMode(mode as any)
229 | setState(initialState(mode))
230 | }}
231 | selected={mode}
232 | options={['mass', 'duration'].map((x) => ({
233 | value: x,
234 | name: x,
235 | }))}
236 | />
237 |
238 | {Object.keys(config).map((key) => {
239 | let conf = config[key as keyof typeof config]
240 | let value = state[key as keyof typeof state] || 0
241 | return (
242 |
243 |
244 |
{key}
245 |
246 |
247 | {value}
248 |
249 |
250 |
{
254 | playbackRate.stop()
255 | playbackRate.jump(0)
256 | setState((prev) => {
257 | return {
258 | ...prev,
259 | [key]: Number(e.target.value),
260 | }
261 | })
262 | }}
263 | step={conf.step}
264 | min={conf.min}
265 | max={conf.max}
266 | />
267 |
268 | )
269 | })}
270 |
271 |
272 |
273 |
274 |
300 |
307 |
308 |
309 | )
310 | }
311 |
312 | const valueFormatterAbsolute = (number: number) =>
313 | Intl.NumberFormat('us').format(number).toString()
314 |
315 | export default App
316 |
317 | function useDebouncedEffect(callback, deps = [], delay = 120) {
318 | const data = React.useRef({
319 | firstTime: true,
320 | clearFunc: null as Function | null,
321 | })
322 | React.useEffect(() => {
323 | const { firstTime, clearFunc } = data.current
324 |
325 | if (firstTime) {
326 | data.current.firstTime = false
327 | }
328 |
329 | const handler = setTimeout(() => {
330 | if (clearFunc && typeof clearFunc === 'function') {
331 | clearFunc()
332 | }
333 | data.current.clearFunc = callback()
334 | }, delay)
335 |
336 | return () => {
337 | clearTimeout(handler)
338 | }
339 | }, [delay, ...deps])
340 | }
341 |
342 | export function getStaticProps(ctx: GetStaticPropsContext) {
343 | return {
344 | props: {},
345 | }
346 | }
347 |
--------------------------------------------------------------------------------
/website/src/pages/index.tsx:
--------------------------------------------------------------------------------
1 | import Page, { getStaticProps } from './home'
2 |
3 | export { getStaticProps }
4 | export default Page
5 |
--------------------------------------------------------------------------------
/website/src/styles/globals.css:
--------------------------------------------------------------------------------
1 | :root {
2 | --page-max-width: 1200px;
3 | --pagePadding: 20px;
4 | }
5 |
6 | /* Fix all that shitty libraries (like chakra) that try to remove scroll bar and layout shift everything */
7 | html > body {
8 | margin-right: 0 !important;
9 | }
10 | /* html {
11 | padding-right: 0 !important;
12 | } */
13 |
14 | * {
15 | box-sizing: border-box;
16 | border-color: theme('colors.gray.200');
17 | }
18 | .dark * {
19 | border-color: theme('colors.gray.600');
20 | }
21 |
22 | /* do not zoom on ios select */
23 | select {
24 | font-size: 16px;
25 | }
26 |
27 | html {
28 | /* min-height: 100%; */
29 | background-color: theme('colors.gray.100');
30 | /* height: 100vh; */
31 | position: relative;
32 | overflow-x: hidden !important;
33 | overflow-y: scroll;
34 | scroll-behavior: smooth;
35 | color: theme('colors.gray.700');
36 | touch-action: pan-x pan-y pinch-zoom !important;
37 | -webkit-tap-highlight-color: transparent !important;
38 | -webkit-touch-callout: none !important;
39 | }
40 |
41 | html.dark {
42 | background-color: theme('colors.gray.900');
43 | color: theme('colors.gray.200');
44 | color-scheme: dark;
45 | }
46 |
47 | #__next {
48 | }
49 |
50 | body {
51 | position: relative;
52 | margin: 0;
53 | scroll-behavior: smooth;
54 | -webkit-font-smoothing: antialiased;
55 | -moz-osx-font-smoothing: grayscale;
56 | text-rendering: optimizeLegibility;
57 | }
58 |
59 | .scrollbar-hide::-webkit-scrollbar {
60 | display: none;
61 | }
62 | .scrollbar-hide {
63 | -ms-overflow-style: none; /* IE and Edge */
64 | scrollbar-width: none; /* Firefox */
65 | }
66 |
--------------------------------------------------------------------------------
/website/src/styles/index.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
5 | @import 'beskar/styles/focus.css';
6 | @import './globals.css';
7 |
--------------------------------------------------------------------------------
/website/tailwind.config.cjs:
--------------------------------------------------------------------------------
1 | const colors = require('beskar/colors')
2 |
3 | /** @type {import('tailwindcss/tailwind-config').TailwindConfig} */
4 | module.exports = {
5 | mode: 'jit',
6 | content: [
7 | './src/**/*.{js,ts,jsx,tsx}', //
8 | '../beskar/src/**/*.{js,ts,jsx,tsx}', //
9 | ],
10 | darkMode: 'class',
11 | theme: {
12 | extend: {
13 | colors: {
14 |
15 | ...colors,
16 | },
17 | },
18 | },
19 | variants: {
20 | extend: {},
21 | },
22 | plugins: [],
23 | }
24 |
--------------------------------------------------------------------------------
/website/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2015",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": false,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "downlevelIteration": true,
12 | "module": "esnext",
13 | "moduleResolution": "node",
14 | "resolveJsonModule": true,
15 | "isolatedModules": true,
16 | "jsx": "preserve",
17 | "baseUrl": "./",
18 | "paths": {
19 | "@app/*": ["./src/*"]
20 | },
21 | "incremental": true
22 | },
23 | "include": ["src", "src/global.ts", "next-env.d.ts", "scripts"],
24 | "exclude": ["node_modules"]
25 | }
26 |
--------------------------------------------------------------------------------
/website/vitest.config.ts:
--------------------------------------------------------------------------------
1 | // vite.config.ts
2 | import { defineConfig } from 'vite'
3 | import tsconfigPaths from 'vite-tsconfig-paths'
4 |
5 | export default defineConfig({
6 | test: {
7 | exclude: ['**/dist/**', '**/esm/**', '**/node_modules/**', '**/e2e/**'],
8 |
9 | threads: false,
10 | },
11 | plugins: [tsconfigPaths()],
12 | })
13 |
--------------------------------------------------------------------------------