Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

💫 pre-compiled real-time ray-tracing with linear-gradients (#883)

PickleNik72d66d4e2766
diff --git a/apps/og-image/app/components/logo3d.tsx b/apps/og-image/app/components/logo3d.tsx
index 21ceadd1..5d70edc6 100644
--- a/apps/og-image/app/components/logo3d.tsx
+++ b/apps/og-image/app/components/logo3d.tsx
@@ -15,7 +15,7 @@ export function Logo3d() {
<path
fillRule="evenodd"
clipRule="evenodd"
- d="M261.441 348.723H333.158V299.842H133.263V348.723H204.629V566.368H261.441V348.723Z"
+ d="M261.441 348.724H333.158V299.842H133.263V348.724H204.629V566.368H261.441V348.724Z"
fill="white"
/>
<path
diff --git a/apps/web/src/app/[locale]/_components/hero.tsx b/apps/web/src/app/[locale]/_components/hero.tsx
index 31882178..371d5395 100644
--- a/apps/web/src/app/[locale]/_components/hero.tsx
+++ b/apps/web/src/app/[locale]/_components/hero.tsx
@@ -10,32 +10,64 @@ function TypeHeroLogo3D() {
<svg
className="h-28 w-28 sm:h-44 sm:w-44"
xmlns="http://www.w3.org/2000/svg"
- viewBox="0 0 638 638"
+ viewBox="0 0 633 633"
fill="none"
>
- <g className="hidden dark:block" filter="url(#filter0_ii_284_103)">
- <rect width="637.029" height="637.029" rx="68.1096" fill="#3178C6" />
+ <g className="dark:hidden">
+ <path
+ d="M0 74.9605C0 33.561 33.561 0 74.9605 0H558.039C599.439 0 633 33.561 633 74.9605V558.039C633 599.439 599.439 633 558.039 633H74.9605C33.561 633 0 599.439 0 558.039V74.9605Z"
+ fill="#3178C6"
+ />
+ <path
+ fillRule="evenodd"
+ clipRule="evenodd"
+ d="M261.441 348.724H333.158V299.842H133.263V348.724H204.629V566.368H261.441V348.724Z"
+ fill="white"
+ />
+ <path
+ d="M366.474 566.368V299.842H423.962V410.298H508.741V299.842H566.368V566.368H508.741V455.523H423.962V566.368H366.474Z"
+ fill="white"
+ />
+ </g>
+ <g className="animate-logo-light hidden dark:block">
+ <path
+ d="M0 74.9605C0 33.561 33.561 0 74.9605 0H558.039C599.439 0 633 33.561 633 74.9605V558.039C633 599.439 599.439 633 558.039 633H74.9605C33.561 633 0 599.439 0 558.039V74.9605Z"
+ fill="#3178C6"
+ />
+ <path
+ fillRule="evenodd"
+ clipRule="evenodd"
+ d="M261.441 348.724H333.158V299.842H133.263V348.724H204.629V566.368H261.441V348.724Z"
+ fill="white"
+ />
+ <path
+ d="M366.474 566.368V299.842H423.962V410.298H508.741V299.842H566.368V566.368H508.741V455.523H423.962V566.368H366.474Z"
+ fill="white"
+ />
</g>
- <g className="block dark:hidden">
- <rect width="637.029" height="637.029" rx="68.1096" fill="#3178C6" />
+ <g className="animate-3d-logo hidden dark:block" filter="url(#filter0_ii_1050_32)">
+ <path
+ d="M0 74.9605C0 33.561 33.561 0 74.9605 0H558.039C599.439 0 633 33.561 633 74.9605V558.039C633 599.439 599.439 633 558.039 633H74.9605C33.561 633 0 599.439 0 558.039V74.9605Z"
+ fill="#3178C6"
+ />
+ <path
+ fillRule="evenodd"
+ clipRule="evenodd"
+ d="M261.441 348.724H333.158V299.842H133.263V348.724H204.629V566.368H261.441V348.724Z"
+ fill="white"
+ />
+ <path
+ d="M366.474 566.368V299.842H423.962V410.298H508.741V299.842H566.368V566.368H508.741V455.523H423.962V566.368H366.474Z"
+ fill="white"
+ />
</g>
- <path
- fillRule="evenodd"
- clipRule="evenodd"
- d="M243.77 314.169H318.615V288.585V263H110V314.169H184.479V542H243.77V314.169Z"
- fill="white"
- />
- <path
- d="M353.385 542V263H413.381V378.626H501.858V263H562V542H501.858V425.967H413.381V542H353.385Z"
- fill="white"
- />
<defs>
<filter
- id="filter0_ii_284_103"
+ id="filter0_ii_1050_32"
x="-49"
y="-49"
- width="736.029"
- height="736.029"
+ width="732"
+ height="732"
filterUnits="userSpaceOnUse"
colorInterpolationFilters="sRGB"
>
@@ -51,7 +83,7 @@ function TypeHeroLogo3D() {
<feGaussianBlur stdDeviation="74.5" />
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1" />
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0" />
- <feBlend mode="normal" in2="shape" result="effect1_innerShadow_284_103" />
+ <feBlend mode="normal" in2="shape" result="effect1_innerShadow_1050_32" />
<feColorMatrix
in="SourceAlpha"
type="matrix"
@@ -64,8 +96,8 @@ function TypeHeroLogo3D() {
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.12 0" />
<feBlend
mode="normal"
- in2="effect1_innerShadow_284_103"
- result="effect2_innerShadow_284_103"
+ in2="effect1_innerShadow_1050_32"
+ result="effect2_innerShadow_1050_32"
/>
</filter>
</defs>
@@ -75,27 +107,27 @@ function TypeHeroLogo3D() {
function BeamOfLight() {
return (
<svg
- className="pointer-events-none absolute left-0 top-0 z-[-1] h-[69%] w-full sm:w-[69%] lg:w-[42%]"
- viewBox="0 0 2378 1682"
- fill="none"
+ className="animate-beam pointer-events-none absolute left-0 top-0 z-[-1] h-[169%] w-[138%] lg:w-[84%]"
xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 3787 2842"
+ fill="none"
>
- <g filter="url(#filter0_f_791_106)">
+ <g filter="url(#filter0_f_1065_8)">
<ellipse
cx="1924.71"
cy="273.501"
rx="1924.71"
ry="273.501"
- transform="matrix(-0.822377 -0.568943 -0.568943 0.822377 2222.88 1131.09)"
+ transform="matrix(-0.822377 -0.568943 -0.568943 0.822377 3631.88 2291.09)"
fill="white"
fillOpacity="0.21"
/>
</g>
<defs>
<filter
- id="filter0_f_791_106"
- x="-1408.14"
- y="-1159.16"
+ id="filter0_f_1065_8"
+ x="0.860352"
+ y="0.838989"
width="3785.16"
height="2840.26"
filterUnits="userSpaceOnUse"
@@ -103,7 +135,7 @@ function BeamOfLight() {
>
<feFlood floodOpacity="0" result="BackgroundImageFix" />
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape" />
- <feGaussianBlur stdDeviation="151" result="effect1_foregroundBlur_791_106" />
+ <feGaussianBlur stdDeviation="151" result="effect1_foregroundBlur_1065_8" />
</filter>
</defs>
</svg>
@@ -118,19 +150,19 @@ export async function Hero() {
<div className="absolute inset-10 -z-30 overflow-hidden rounded-full opacity-70 lg:hidden">
<BackgroundGrid />
</div>
- <BeamOfLight />
- <div className="container grid min-h-screen items-center justify-center lg:min-h-0 lg:grid-cols-2">
+ <div className="container relative grid min-h-screen items-center justify-center lg:min-h-0 lg:grid-cols-2">
+ <BeamOfLight />
<div className="flex w-full flex-col items-center justify-center gap-10 lg:items-start">
<a
target="_blank"
rel="noreferrer"
href="https://github.com/typehero/typehero"
- className="group rounded-full bg-gradient-to-r from-yellow-600 via-black to-[#3178c6] to-70% bg-[length:420%_420%] bg-center p-[1px] brightness-90 contrast-150 duration-500 hover:bg-left-top hover:shadow-[0_0_2rem_-0.75rem_#eab308] dark:from-yellow-500 dark:via-white dark:to-[#3178c6] dark:brightness-125 dark:contrast-100"
+ className="animate-bg-gradient-to-center group rounded-full bg-gradient-to-r from-yellow-600 via-[#3178c6] to-[#3178c6] to-70% bg-[length:420%_420%] bg-right-bottom p-[1px] brightness-90 contrast-150 duration-500 hover:bg-left-top hover:shadow-[0_0_2rem_-0.5rem_#3178c6] dark:from-yellow-500 dark:via-white dark:to-[#3178c6] dark:brightness-125 dark:contrast-100 dark:hover:shadow-[0_0_2rem_-0.5rem_#fff8]"
>
<div className="rounded-full bg-white/80 px-3 py-1 dark:bg-black/80">
- <span className="dark:to-via-white relative flex items-center bg-gradient-to-r from-yellow-600 via-black to-[#3178c6] to-70% bg-[length:420%_420%] bg-clip-text bg-center text-transparent duration-500 group-hover:bg-left-top dark:from-yellow-500 dark:via-white dark:to-[#3178c6]">
- <Sparkles className="absolute -left-1 top-0.5 h-5 w-5 translate-x-0.5 scale-50 stroke-yellow-500 opacity-0 duration-500 dark:group-hover:rotate-[125deg] dark:group-hover:scale-100 dark:group-hover:opacity-100" />
- <Sparkle className="mr-2 h-4 w-4 stroke-black stroke-2 duration-500 group-hover:rotate-180 group-hover:scale-110 group-hover:stroke-yellow-600 dark:stroke-white dark:duration-500 dark:group-hover:scale-[2] dark:group-hover:opacity-0" />{' '}
+ <span className="animate-bg-gradient-to-center relative flex items-center bg-gradient-to-r to-70% bg-[length:420%_420%] bg-clip-text bg-right-bottom text-transparent duration-500 group-hover:bg-left-top dark:from-yellow-500 dark:via-white dark:to-[#3178c6]">
+ <Sparkle className="animate-oldstar absolute -left-1 top-0.5 mr-2 h-5 w-5 translate-x-0.5 stroke-[#3178c6] stroke-2 duration-500 group-hover:rotate-180 group-hover:scale-110 group-hover:stroke-yellow-600 dark:duration-500 " />
+ <Sparkle className="animate-newstar mr-2 h-4 w-4 stroke-[#3178c6] stroke-2 duration-500 group-hover:rotate-180 group-hover:scale-110 group-hover:fill-[#3178c6] dark:stroke-white dark:duration-500 dark:group-hover:fill-white" />{' '}
Star us on Github
</span>
</div>
@@ -139,7 +171,7 @@ export async function Hero() {
<div className="absolute left-1/2 top-1/2 -z-10 hidden h-56 w-56 -translate-x-[15%] -translate-y-[50%] rounded-full bg-slate-400/10 blur-3xl dark:block" />
<div className="absolute right-1/2 top-1/2 -z-10 hidden h-56 w-56 -translate-y-[40%] rounded-full bg-[#3178c6]/20 blur-3xl dark:block" />
<TypeHeroLogo3D />
- <h1 className="bg-gradient-to-br from-[#3178c6] from-[69%] to-black/0 bg-clip-text text-6xl font-extrabold text-transparent dark:from-white dark:from-0% dark:to-[#3178c6] sm:text-8xl sm:leading-[5.5rem]">
+ <h1 className="animate-bg-gradient-to-center-title dark:to-69% bg-gradient-to-br from-[#3178c6] from-[69%] to-black/0 bg-clip-text bg-right-bottom text-6xl font-extrabold text-transparent dark:from-white dark:from-30% dark:via-[#3178c6] dark:to-[#3178c6] dark:bg-[length:300%_300%] sm:text-8xl sm:leading-[5.5rem]">
type
<br />
hero
diff --git a/apps/web/src/components/navigation.tsx b/apps/web/src/components/navigation.tsx
index a02e2ff1..3c562700 100644
--- a/apps/web/src/components/navigation.tsx
+++ b/apps/web/src/components/navigation.tsx
@@ -45,12 +45,12 @@ export function Navigation() {
<div className="flex w-full items-center justify-between">
<div className="relative flex items-center gap-3">
<Link
- className="flex items-center space-x-2 focus:outline-none focus-visible:ring-2"
+ className="flex items-center space-x-1.5 focus:outline-none focus-visible:ring-2"
href="/"
>
<svg
xmlns="http://www.w3.org/2000/svg"
- className="h-8 w-8 rounded-md"
+ className="h-6 w-6"
viewBox="0 0 38 38"
fill="none"
>
diff --git a/apps/web/src/styles/globals.css b/apps/web/src/styles/globals.css
index 8d95f3ae..f54454ae 100644
--- a/apps/web/src/styles/globals.css
+++ b/apps/web/src/styles/globals.css
@@ -303,6 +303,91 @@ main {
animation: gradient-rotate 5s linear infinite reverse;
}
+.animate-beam {
+ opacity: 0;
+ transform: translate(-72%, -62%) scale(0.5);
+ animation: beam 2s 0.75s ease 1 forwards;
+}
+
+@keyframes beam {
+ to {
+ opacity: 1;
+ transform: translate(-50%, -40%) scale(1);
+ }
+}
+
+/* portrait */
+@media (orientation: portrait) {
+ .animate-beam {
+ opacity: 0;
+ transform: translate(-62%, -40%) scale(0.5);
+ animation: beam 2s 0.75s ease 1 forwards;
+ }
+}
+
+/* tablet */
+@media (max-width: 1025px) {
+ @keyframes beam {
+ to {
+ opacity: 1;
+ transform: translate(-40%, -40%) scale(1);
+ }
+ }
+}
+
+.animate-newstar {
+ opacity: 0;
+ animation: newstar 1.5s 0.95s ease 1 forwards;
+}
+.animate-oldstar {
+ opacity: 1;
+ animation: oldstar 1.5s 0.95s ease 1 forwards;
+}
+
+@keyframes newstar {
+ to {
+ opacity: 1;
+ }
+}
+@keyframes oldstar {
+ to {
+ opacity: 0;
+ }
+}
+
+.animate-bg-gradient-to-center {
+ animation: bg-to-center 1s 0.75s ease 1 forwards;
+}
+.animate-bg-gradient-to-center-title {
+ animation: bg-to-center 1s 0.95s ease 1 forwards;
+}
+
+@keyframes bg-to-center {
+ to {
+ background-position: center;
+ }
+}
+
+.animate-logo-light {
+ filter: brightness(90%);
+ animation: logo-light 1.25s 0.85s ease 1 forwards;
+}
+@keyframes logo-light {
+ to {
+ filter: brightness(110%);
+ }
+}
+
+.animate-3d-logo {
+ opacity: 0.1;
+ animation: logo-3d 1.25s 0.85s ease 1 forwards;
+}
+@keyframes logo-3d {
+ to {
+ opacity: 1;
+ }
+}
+
@keyframes gradient-rotate {
0% {
--gradient-angle: 360deg;