Skip to content

Production-ready animations, transitions, backgrounds, and scenes for Remotion

perf: remove import all from remocn registry, rewrite animations using width, height

dev_wandry023be50ad3e4
diff --git a/app/(home)/components/sections/hero-scroll-video.tsx b/app/(home)/components/sections/hero-scroll-video.tsx
index 3ba52a25..4b94c237 100644
--- a/app/(home)/components/sections/hero-scroll-video.tsx
+++ b/app/(home)/components/sections/hero-scroll-video.tsx
@@ -93,19 +93,21 @@ function ScrollStage({
const restWidth = Math.min(viewport.w * REST_WIDTH_RATIO, REST_MAX_WIDTH);
const restHeight = restWidth * CARD_ASPECT;
+ const restScaleX = restWidth / viewport.w;
+ const restScaleY = restHeight / viewport.h;
const keyframes = [0, GROW_END, HOLD_END, 1];
- const width = useTransform(scrollYProgress, keyframes, [
- restWidth,
- viewport.w,
- viewport.w,
- restWidth,
+ const scaleX = useTransform(scrollYProgress, keyframes, [
+ restScaleX,
+ 1,
+ 1,
+ restScaleX,
]);
- const height = useTransform(scrollYProgress, keyframes, [
- restHeight,
- viewport.h,
- viewport.h,
- restHeight,
+ const scaleY = useTransform(scrollYProgress, keyframes, [
+ restScaleY,
+ 1,
+ 1,
+ restScaleY,
]);
const borderRadius = useTransform(scrollYProgress, keyframes, [
REST_RADIUS,
@@ -118,8 +120,14 @@ function ScrollStage({
<section ref={sectionRef} data-hero-zoom className="relative h-[380vh]">
<div className="sticky top-0 flex h-screen w-full items-center justify-center overflow-hidden">
<motion.div
- style={{ width, height, borderRadius }}
- className="group surface-card relative overflow-hidden shadow-black/5 will-change-[width,height] dark:shadow-black/40"
+ style={{
+ width: viewport.w,
+ height: viewport.h,
+ scaleX,
+ scaleY,
+ borderRadius,
+ }}
+ className="group surface-card relative overflow-hidden shadow-black/5 will-change-transform dark:shadow-black/40"
>
<VideoCard
videoRef={videoRef}
diff --git a/app/(home)/components/sections/whats-inside.tsx b/app/(home)/components/sections/whats-inside.tsx
index fdf2cfaf..7b41bf5a 100644
--- a/app/(home)/components/sections/whats-inside.tsx
+++ b/app/(home)/components/sections/whats-inside.tsx
@@ -7,7 +7,7 @@ import Link from "next/link";
import { type ComponentType, useRef } from "react";
import { SPRING_SOFT } from "@/config/site";
import { cn } from "@/lib/utils";
-import registry from "@/registry/__index__";
+import { shaderGrainGradientConfig } from "@/registry/remocn/shader-grain-gradient/config";
import { FadeUp } from "../fade-up";
import { SectionHeading } from "../section-heading";
import { useAutoplay } from "../use-autoplay";
@@ -92,19 +92,19 @@ const SHADER_PREVIEW_WIDTH = 480;
const SHADER_PREVIEW_HEIGHT = 270;
const SHADER_PREVIEW_FPS = 20;
+const loadShaderGrainGradient = () =>
+ import("@/registry/remocn/shader-grain-gradient").then((m) => ({
+ default: m.ShaderGrainGradient,
+ }));
+
function ShadersViz({ play }: VizProps) {
const reduced = useReducedMotion();
- const entry = registry["shader-grain-gradient"];
const playerRef = useRef<PlayerRef>(null);
- const { containerRef } = useAutoplay(
- playerRef,
- Boolean(entry) && play && !reduced,
- );
-
- if (!entry) return null;
+ const { containerRef } = useAutoplay(playerRef, play && !reduced);
const durationInFrames = Math.round(
- (entry.config.durationInFrames * SHADER_PREVIEW_FPS) / entry.config.fps,
+ (shaderGrainGradientConfig.durationInFrames * SHADER_PREVIEW_FPS) /
+ shaderGrainGradientConfig.fps,
);
return (
@@ -112,7 +112,7 @@ function ShadersViz({ play }: VizProps) {
<div className="absolute top-1/2 left-1/2 aspect-video min-h-full min-w-full -translate-x-1/2 -translate-y-1/2 will-change-transform">
<Player
ref={playerRef}
- lazyComponent={entry.load}
+ lazyComponent={loadShaderGrainGradient}
inputProps={{}}
durationInFrames={durationInFrames}
fps={SHADER_PREVIEW_FPS}