Skip to content
Merged
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
10 changes: 5 additions & 5 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"gray-matter": "^4.0.3",
"lucide-react": "^0.559.0",
"mathjs": "^14.6.0",
"motion": "^12.25.0",
"motion": "^12.29.2",
"next": "16.1.3",
"next-mdx-remote": "^5.0.0",
"next-themes": "^0.4.6",
Expand Down
16 changes: 16 additions & 0 deletions src/app/[lang]/(home)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
BookIcon,
MessageSquareIcon,
ArrowUpRightIcon,
ArrowRightIcon,
} from "lucide-react";
import { FlipWords } from "@/components/ui/flip-words";
import { Spotlight } from "@/components/ui/spotlight-new";
Expand Down Expand Up @@ -36,6 +37,7 @@ import { DiscordButton } from "./discord-button";
import { SponsorButton } from "./support-button";
import { GitInfoButton } from "@/components/git-info-button";
import { useState, ViewTransition, useMemo } from "react";
import { GlowEffect } from "@/components/ui/glow-effect";

type ProjectType = "art" | "website" | "server" | "mod";

Expand Down Expand Up @@ -306,6 +308,20 @@ export default function HomePage() {
<div className="max-w-5xl space-y-8 pt-16 text-center md:pt-0">
<ViewTransition name="hero" share="blur-scale-transition">
<div className="space-y-6">
<div className="relative w-lg mx-auto">
<GlowEffect
colors={["#FF5733", "#33FF57", "#3357FF", "#F1C40F"]}
mode="flowHorizontal"
blur="soft"
duration={3}
scale={0.9}
/>
<Button className="relative w-115 bg-background hover:bg-background/85" variant={"secondary"} asChild>
<Link href={"https://hytalemodjam.com"}>
We&apos;re hosting the first Hytale Modjam with $4,000 in prizes! <ArrowRightIcon className="h4 w-4" />
</Link>
</Button>
</div>
<h1 className="text-4xl font-semibold text-balance md:text-5xl">
<div>{messages.home.title.split("{flipwords}")[0]}</div>
<div>
Expand Down
151 changes: 151 additions & 0 deletions src/components/ui/glow-effect.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
'use client';
import { cn } from '@/lib/utils';
import { motion, Transition } from 'motion/react';

export type GlowEffectProps = {
className?: string;
style?: React.CSSProperties;
colors?: string[];
mode?:
| 'rotate'
| 'pulse'
| 'breathe'
| 'colorShift'
| 'flowHorizontal'
| 'static';
blur?:
| number
| 'softest'
| 'soft'
| 'medium'
| 'strong'
| 'stronger'
| 'strongest'
| 'none';
transition?: Transition;
scale?: number;
duration?: number;
};

export function GlowEffect({
className,
style,
colors = ['#FF5733', '#33FF57', '#3357FF', '#F1C40F'],
mode = 'rotate',
blur = 'medium',
transition,
scale = 1,
duration = 5,
}: GlowEffectProps) {
const BASE_TRANSITION = {
repeat: Infinity,
duration: duration,
ease: 'linear',
};

const animations = {
rotate: {
background: [
`conic-gradient(from 0deg at 50% 50%, ${colors.join(', ')})`,
`conic-gradient(from 360deg at 50% 50%, ${colors.join(', ')})`,
],
transition: {
...(transition ?? BASE_TRANSITION),
},
},
pulse: {
background: colors.map(
(color) =>
`radial-gradient(circle at 50% 50%, ${color} 0%, transparent 100%)`
),
scale: [1 * scale, 1.1 * scale, 1 * scale],
opacity: [0.5, 0.8, 0.5],
transition: {
...(transition ?? {
...BASE_TRANSITION,
repeatType: 'mirror',
}),
},
},
breathe: {
background: [
...colors.map(
(color) =>
`radial-gradient(circle at 50% 50%, ${color} 0%, transparent 100%)`
),
],
scale: [1 * scale, 1.05 * scale, 1 * scale],
transition: {
...(transition ?? {
...BASE_TRANSITION,
repeatType: 'mirror',
}),
},
},
colorShift: {
background: colors.map((color, index) => {
const nextColor = colors[(index + 1) % colors.length];
return `conic-gradient(from 0deg at 50% 50%, ${color} 0%, ${nextColor} 50%, ${color} 100%)`;
}),
transition: {
...(transition ?? {
...BASE_TRANSITION,
repeatType: 'mirror',
}),
},
},
flowHorizontal: {
background: colors.map((color) => {
const nextColor = colors[(colors.indexOf(color) + 1) % colors.length];
return `linear-gradient(to right, ${color}, ${nextColor})`;
}),
transition: {
...(transition ?? {
...BASE_TRANSITION,
repeatType: 'mirror',
}),
},
},
static: {
background: `linear-gradient(to right, ${colors.join(', ')})`,
},
};

const getBlurClass = (blur: GlowEffectProps['blur']) => {
if (typeof blur === 'number') {
return `blur-[${blur}px]`;
}

const presets = {
softest: 'blur-xs',
soft: 'blur-sm',
medium: 'blur-md',
strong: 'blur-lg',
stronger: 'blur-xl',
strongest: 'blur-xl',
none: 'blur-none',
};

return presets[blur as keyof typeof presets];
};

return (
<motion.div
style={
{
...style,
'--scale': scale,
willChange: 'transform',
backfaceVisibility: 'hidden',
} as React.CSSProperties
}
animate={animations[mode]}
className={cn(
'pointer-events-none absolute inset-0 h-full w-full',
'scale-[var(--scale)] transform-gpu',
getBlurClass(blur),
className
)}
/>
);
}
Loading