Become a founding member.

← Catalog
No preview yet

Source

471 lines
// Viral Clips Row: a MOMENT (proof).
//
// Three phones fan in left to right, each playing a clip, and a view
// count pops under each one. Then a coin drops in above them and green
// dollar signs burst around it: the views turned into money.
//
// Rebuilt from "The Only AI Influencer Side Hustle That Actually Pays!"
// (Wealth Wisdom, youtube.com/watch?v=ketIzKnJoI4). Timing is authored in
// frames at 30 fps and scaled to the composition's fps.
//
// Each clip slot takes a video or an image url; an empty slot shows a
// color tile, never a blank phone. Which element plays it: the slot's
// declared kind wins, then a decisive file extension, and an url that says
// neither (a CDN upload, a `?alt=media` link) is an image, because an image
// in a video element fails the render with no fallback.

import { loadFont } from '@remotion/google-fonts/InterTight';
import {
  AbsoluteFill,
  Easing,
  Img,
  interpolate,
  OffthreadVideo,
  useCurrentFrame,
  useVideoConfig,
} from 'remotion';

const { fontFamily: INTER_TIGHT } = loadFont('normal', {
  weights: ['700', '900'],
  subsets: ['latin'],
});

export type ClipKind = 'auto' | 'video' | 'image';

export type ViralClipsRowProps = {
  clip1: string;
  clip2: string;
  clip3: string;
  clip1Kind: ClipKind;
  clip2Kind: ClipKind;
  clip3Kind: ClipKind;
  views1: string;
  views2: string;
  views3: string;
  showPayout: boolean;
  backgroundColor: string;
  moneyColor: string;
  coinColor: string;
};

/** The beats, in frames at 30 fps. Mirrored in the meta's `moment.beats`. */
export const beats = [
  { label: 'phones fan in', from: 2, to: 18 },
  { label: 'view counts pop', from: 8, to: 27 },
  { label: 'coin drops', from: 66, to: 82 },
  { label: 'money burst', from: 72, to: 123 },
];

const STAGE_W = 1920;
const STAGE_H = 1080;
const BOX_W = 1300;
const BOX_H = 1080;

const PHONE_W = 273.3;
const PHONE_H = 570.2;
const BEZEL = 9.2;

const PHONES = [
  { x: 403.3, y: 344.9, rotate: -9, inAt: 2 },
  { x: 823.3, y: 324.9, rotate: 0, inAt: 7 },
  { x: 1243.3, y: 344.9, rotate: 9, inAt: 12 },
];

// Dollar signs around the coin, in the order they pop (3 frames apart).
const BURST = [
  { x: 1110, y: 175 },
  { x: 1015, y: 218.3 },
  { x: 825, y: 218.3 },
  { x: 730, y: 175 },
  { x: 825, y: 131.7 },
  { x: 1015, y: 131.7 },
];

const FALLBACK_TILES = [
  'linear-gradient(160deg, #FBD3E9 0%, #BB377D 100%)',
  'linear-gradient(160deg, #A1C4FD 0%, #4A5BD8 100%)',
  'linear-gradient(160deg, #FFE29F 0%, #FF9A5A 100%)',
];

const clamp = { extrapolateLeft: 'clamp', extrapolateRight: 'clamp' } as const;
const outCubic = Easing.out(Easing.cubic);
const outBack = Easing.out(Easing.back(1.7));

const VIDEO_EXT = /\.(mp4|mov|m4v|webm|mkv)$/i;

/** Declared kind first, then a decisive extension; ambiguous is an image. */
export function clipIsVideo(src: string, kind: ClipKind | undefined): boolean {
  if (kind === 'video') return true;
  if (kind === 'image') return false;
  return VIDEO_EXT.test(src.split(/[?#]/)[0]);
}

function ClipMedia({
  src,
  kind,
  fallback,
}: {
  src: string;
  kind: ClipKind | undefined;
  fallback: string;
}) {
  const fill = {
    position: 'absolute' as const,
    inset: 0,
    width: '100%',
    height: '100%',
    objectFit: 'cover' as const,
  };
  if (typeof src !== 'string' || !/^https?:\/\//i.test(src.trim())) {
    return <div style={{ ...fill, background: fallback }} />;
  }
  if (clipIsVideo(src, kind))
    return <OffthreadVideo src={src} muted style={fill} />;
  return <Img src={src} style={fill} />;
}

function Phone({
  x,
  y,
  rotate,
  opacity,
  src,
  kind,
  fallback,
}: {
  x: number;
  y: number;
  rotate: number;
  opacity: number;
  src: string;
  kind: ClipKind | undefined;
  fallback: string;
}) {
  return (
    <div
      style={{
        position: 'absolute',
        left: x,
        top: y,
        width: PHONE_W,
        height: PHONE_H,
        borderRadius: 43.2,
        background: '#16161A',
        boxShadow: '0 28px 64px rgba(20,16,60,0.26)',
        transform: `rotate(${rotate}deg)`,
        opacity,
      }}
    >
      <div
        style={{
          position: 'absolute',
          left: BEZEL,
          top: BEZEL,
          width: PHONE_W - BEZEL * 2,
          height: PHONE_H - BEZEL * 2,
          borderRadius: 34,
          overflow: 'hidden',
          background: '#111114',
        }}
      >
        <ClipMedia src={src} kind={kind} fallback={fallback} />
        {/* Status bar over the clip */}
        <div
          style={{
            position: 'absolute',
            left: 19.6,
            top: 9.8,
            width: 46,
            height: 16,
            fontSize: 11.1,
            fontWeight: 700,
            color: '#FFFFFF',
            textAlign: 'center',
            lineHeight: '16px',
            textShadow: '0 1px 2px rgba(0,0,0,0.35)',
          }}
        >
          9:41
        </div>
        <div
          style={{
            position: 'absolute',
            left: 86.3,
            top: 7,
            width: 82.4,
            height: 23.5,
            borderRadius: 11.8,
            background: '#000000',
          }}
        />
        {[2.9, 4.2, 5.6, 6.9].map((h, i) => (
          <div
            key={`bar-${i}`}
            style={{
              position: 'absolute',
              left: 188.3 + i * 3.25,
              top: 19.6 - h,
              width: 2.2,
              height: h,
              borderRadius: 0.7,
              background: '#FFFFFF',
            }}
          />
        ))}
        <svg
          width={11.8}
          height={11.8}
          viewBox='0 0 11.8 11.8'
          style={{ position: 'absolute', left: 203.3, top: 9.8 }}
        >
          <path
            d='M 1.5 4.4 C 3.7 2.2 8.1 2.2 10.3 4.4 M 2.9 6.1 C 4.7 4.7 7.1 4.7 8.8 6.1 M 4.7 7.8 C 5.4 7.4 6.4 7.4 7.1 7.8'
            fill='none'
            stroke='#FFFFFF'
            strokeWidth={1.08}
            strokeLinecap='round'
          />
        </svg>
        <div
          style={{
            position: 'absolute',
            left: 218.4,
            top: 12.4,
            width: 15.7,
            height: 7.8,
            borderRadius: 2.3,
            border: '0.85px solid #FFFFFF',
            boxSizing: 'border-box',
          }}
        />
        <div
          style={{
            position: 'absolute',
            left: 219.7,
            top: 13.7,
            width: 11.8,
            height: 5.2,
            borderRadius: 1.3,
            background: '#FFFFFF',
          }}
        />
        <div
          style={{
            position: 'absolute',
            left: 83.7,
            top: 542.7,
            width: 87.6,
            height: 3.3,
            borderRadius: 1.6,
            background: '#FFFFFF',
          }}
        />
      </div>
    </div>
  );
}

function ViewsPill({
  x,
  y,
  t,
  inAt,
  label,
}: {
  x: number;
  y: number;
  t: number;
  inAt: number;
  label: string;
}) {
  const scale = interpolate(t, [inAt, inAt + 9], [0.5, 1], {
    ...clamp,
    easing: outBack,
  });
  const opacity = interpolate(t, [inAt, inAt + 6], [0, 1], {
    ...clamp,
    easing: outCubic,
  });
  return (
    <div
      style={{
        position: 'absolute',
        left: x,
        top: y,
        width: 210,
        height: 62,
        borderRadius: 31,
        background: '#FFFFFF',
        boxShadow: '0 8px 20px rgba(0,0,0,0.16)',
        transform: `scale(${scale})`,
        opacity,
      }}
    >
      <svg
        width={26}
        height={26}
        viewBox='0 0 26 26'
        style={{ position: 'absolute', left: 26, top: 18 }}
      >
        <path d='M 8.7 5.4 L 20.6 13.0 L 8.7 20.6 Z' fill='#0e0e13' />
      </svg>
      <div
        style={{
          position: 'absolute',
          left: 53,
          top: 9,
          width: 140,
          height: 44,
          fontSize: 30,
          fontWeight: 900,
          color: '#0e0e13',
          textAlign: 'center',
          lineHeight: '44px',
          whiteSpace: 'nowrap',
          overflow: 'hidden',
          textOverflow: 'ellipsis',
        }}
      >
        {label}
      </div>
    </div>
  );
}

export default function ViralClipsRow({
  clip1 = '',
  clip2 = '',
  clip3 = '',
  clip1Kind = 'auto',
  clip2Kind = 'auto',
  clip3Kind = 'auto',
  views1 = '759K',
  views2 = '464K',
  views3 = '325K',
  showPayout = true,
  backgroundColor = '#FAFAFC',
  moneyColor = '#22C55E',
  coinColor = '#F5B83D',
}: Partial<ViralClipsRowProps>) {
  const frame = useCurrentFrame();
  const { fps, width, height } = useVideoConfig();
  const t = (frame * 30) / fps;
  const fit = Math.min(width / BOX_W, height / BOX_H);

  const clips = [clip1, clip2, clip3];
  const kinds = [clip1Kind, clip2Kind, clip3Kind];
  const views = [views1, views2, views3];

  const coinY = interpolate(t, [66, 82], [-15, 145], {
    ...clamp,
    easing: outCubic,
  });
  const coinOpacity = interpolate(t, [66, 72], [0, 1], {
    ...clamp,
    easing: outCubic,
  });

  return (
    <AbsoluteFill
      style={{ backgroundColor, overflow: 'hidden', fontFamily: INTER_TIGHT }}
    >
      <div
        style={{
          position: 'absolute',
          left: width / 2,
          top: height / 2,
          width: STAGE_W,
          height: STAGE_H,
          transformOrigin: '0 0',
          transform: `scale(${fit}) translate(${-STAGE_W / 2}px, ${
            -STAGE_H / 2
          }px)`,
        }}
      >
        {PHONES.map((p, i) => (
          <Phone
            key={`phone-${i}`}
            x={p.x}
            y={p.y}
            rotate={p.rotate}
            opacity={interpolate(t, [p.inAt, p.inAt + 6], [0, 1], {
              ...clamp,
              easing: outCubic,
            })}
            src={clips[i]}
            kind={kinds[i]}
            fallback={FALLBACK_TILES[i]}
          />
        ))}
        {PHONES.map((p, i) =>
          views[i] ? (
            <ViewsPill
              key={`views-${i}`}
              x={p.x + 31.7}
              y={i === 1 ? 910.1 : 930.1}
              t={t}
              inAt={p.inAt + 6}
              label={views[i]}
            />
          ) : null
        )}

        {showPayout ? (
          <>
            <div
              style={{
                position: 'absolute',
                left: 900,
                top: coinY,
                width: 120,
                height: 120,
                borderRadius: 60,
                background: coinColor,
                border: '7.2px solid rgba(0,0,0,0.12)',
                boxSizing: 'border-box',
                opacity: coinOpacity,
                fontSize: 67.2,
                fontWeight: 900,
                color: 'rgba(0,0,0,0.42)',
                textAlign: 'center',
                lineHeight: '106px',
              }}
            >
              $
            </div>
            {BURST.map((b, i) => {
              const at = 72 + i * 3;
              return (
                <div
                  key={`burst-${i}`}
                  style={{
                    position: 'absolute',
                    left: b.x,
                    top: b.y,
                    width: 80,
                    height: 60,
                    fontSize: 46,
                    fontWeight: 900,
                    color: moneyColor,
                    textAlign: 'center',
                    lineHeight: '60px',
                    transform: `scale(${interpolate(t, [at, at + 9], [0.3, 1], {
                      ...clamp,
                      easing: outBack,
                    })})`,
                    opacity:
                      interpolate(t, [at, at + 6], [0, 1], clamp) *
                      interpolate(t, [at + 30, at + 36], [1, 0], clamp),
                  }}
                >
                  $
                </div>
              );
            })}
          </>
        ) : null}
      </div>
    </AbsoluteFill>
  );
}

Schema (Zod)

import { z } from 'zod';

export const Schema = z.object({
  clip1: z
    .string()
    .default('')
    .describe('$port:video Left phone clip (a video or an image url)'),
  clip2: z
    .string()
    .default('')
    .describe('$port:video Middle phone clip (a video or an image url)'),
  clip3: z
    .string()
    .default('')
    .describe('$port:video Right phone clip (a video or an image url)'),
  clip1Kind: z
    .enum(['auto', 'video', 'image'])
    .default('auto')
    .describe(
      '$style:select Left clip is a video or an image. Auto reads the file ending; a link with no ending is treated as an image, so pick video for one.'
    ),
  clip2Kind: z
    .enum(['auto', 'video', 'image'])
    .default('auto')
    .describe('$style:select Middle clip is a video or an image'),
  clip3Kind: z
    .enum(['auto', 'video', 'image'])
    .default('auto')
    .describe('$style:select Right clip is a video or an image'),

  views1: z.string().default('759K').describe('View count under the left clip'),
  views2: z
    .string()
    .default('464K')
    .describe('View count under the middle clip'),
  views3: z
    .string()
    .default('325K')
    .describe('View count under the right clip'),
  showPayout: z
    .boolean()
    .default(true)
    .describe('Drop a coin and burst dollar signs after the views land'),

  backgroundColor: z
    .string()
    .default('#FAFAFC')
    .describe('$style:color Background color'),
  moneyColor: z
    .string()
    .default('#22C55E')
    .describe('$style:color Dollar sign color'),
  coinColor: z.string().default('#F5B83D').describe('$style:color Coin color'),
});

Viral Clips Row

viral_clips_row

Moment (proof). Three phones fan in, each playing a clip, and a view count pops under each. Then a coin drops in and dollar signs burst: the views paid. Wire clips (video or image) into the three VIDEO ports and set the view counts.

Workflow Inputs (3)

  • Left phone clip (a video or an image url)
    clip1
    VIDEO
  • Middle phone clip (a video or an image url)
    clip2
    VIDEO
  • Right phone clip (a video or an image url)
    clip3
    VIDEO

Config Fields (10)

  • views1
  • views2
  • views3
  • clip1Kind
  • clip2Kind
  • clip3Kind
  • coinColor
  • moneyColor
  • showPayout
  • backgroundColor

Meta

Updated
10/15/2026
Start here

Ask Claude for your next ad.

Connect once. Ask any time.

  • No credit card
  • You keep the rights to what you make
  • Cancel anytime