Skip to content

Open source CapCut alternative.

TypeScript

feat(site): shake the plans tape when the slide lands

David Lee72802c6fe42
diff --git a/site/src/app/_components/landing/LandingPrimitives.tsx b/site/src/app/_components/landing/LandingPrimitives.tsx
index 7eb0f173..318acb2e 100644
--- a/site/src/app/_components/landing/LandingPrimitives.tsx
+++ b/site/src/app/_components/landing/LandingPrimitives.tsx
@@ -29,6 +29,10 @@ type TapedCardProps = {
style?: CSSProperties;
tapeColor?: CardColor;
tapePosition?: "left" | "right" | "center";
+ // Opt-in hook for animating the tape. The tape's resting tilt and centering
+ // live in the individual `rotate` / `translate` properties rather than one
+ // `transform`, so a class can animate the tilt alone and leave the rest.
+ tapeClassName?: string;
};
export function TapedCard({
@@ -38,6 +42,7 @@ export function TapedCard({
shadowColor,
style,
tapeColor,
+ tapeClassName,
tapePosition = "left",
}: TapedCardProps) {
const tapeSide =
@@ -46,10 +51,7 @@ export function TapedCard({
: tapePosition === "right"
? { right: 32 }
: { left: "50%" };
- const tapeTransform =
- tapePosition === "center"
- ? "translateX(-50%) rotate(-2deg)"
- : "rotate(-2deg)";
+ const tapeTranslate = tapePosition === "center" ? "-50% 0" : undefined;
return (
<div
@@ -82,6 +84,7 @@ export function TapedCard({
>
{tapeColor ? (
<div
+ className={tapeClassName}
style={{
position: "absolute",
top: -10,
@@ -91,7 +94,8 @@ export function TapedCard({
border: `2px solid ${BLACK}`,
background: CARD[tapeColor],
boxShadow: "0 1px 2px rgba(0,0,0,0.1)",
- transform: tapeTransform,
+ rotate: "-2deg",
+ translate: tapeTranslate,
...tapeSide,
}}
/>
diff --git a/site/src/cut/components/onboarding/onboarding.css b/site/src/cut/components/onboarding/onboarding.css
new file mode 100644
index 00000000..c25cf684
--- /dev/null
+++ b/site/src/cut/components/onboarding/onboarding.css
@@ -0,0 +1,42 @@
+/* Animations for the welcome sequence. Decorative only — every one of them
+ stops under prefers-reduced-motion. */
+
+/* The plans card's tape flutters once when the slide arrives, so the eye lands
+ on the offer. Only the tilt moves; the tape's resting -2deg and its centering
+ offset stay in the individual transform properties TapedCard sets. */
+@keyframes onboarding-tape-shake {
+ 0% {
+ rotate: -2deg;
+ }
+ 12% {
+ rotate: -13deg;
+ }
+ 26% {
+ rotate: 7deg;
+ }
+ 40% {
+ rotate: -10deg;
+ }
+ 54% {
+ rotate: 3deg;
+ }
+ 68% {
+ rotate: -6deg;
+ }
+ 84% {
+ rotate: -0.5deg;
+ }
+ 100% {
+ rotate: -2deg;
+ }
+}
+
+.onboarding-tape-shake {
+ animation: onboarding-tape-shake 700ms ease-in-out 250ms both;
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .onboarding-tape-shake {
+ animation: none;
+ }
+}
diff --git a/site/src/cut/components/onboarding/slides/Plans.tsx b/site/src/cut/components/onboarding/slides/Plans.tsx
index 5106df6f..944ab5cc 100644
--- a/site/src/cut/components/onboarding/slides/Plans.tsx
+++ b/site/src/cut/components/onboarding/slides/Plans.tsx
@@ -7,6 +7,8 @@ import { CUT_PRO } from "@/app/cut/_components/landing/cutPricingPlans";
import { Button } from "@/components/ui/button";
import { useUpgradeToPro } from "@/cut/lib/proUpgrade";
+import "../onboarding.css";
+
// The sequence's last word: Pro is the offer, free is the default, and the
// benefits sit in the card so nobody has to take the price on faith. It's the
// landing's own Pro card — same taped coral frame, same ringed check bullets —
@@ -25,7 +27,12 @@ export function PlansSlide({ onSkipPro }: { onSkipPro: () => void }) {
</p>
<div className="mt-8">
- <TapedCard color="coral" tapeColor="yellow" tapePosition="right">
+ <TapedCard
+ color="coral"
+ tapeColor="yellow"
+ tapePosition="right"
+ tapeClassName="onboarding-tape-shake"
+ >
<div className="p-7 md:p-9">
<div className="text-[22px] font-semibold">Pro</div>
<div className="mt-4 text-[clamp(34px,4.4vw,48px)] leading-[0.95] font-semibold">
@@ -69,7 +76,7 @@ export function PlansSlide({ onSkipPro }: { onSkipPro: () => void }) {
onClick={onSkipPro}
className="text-[15px] text-[#454545] underline-offset-4 transition-colors hover:text-ink hover:underline"
>
- Continue free
+ Continue with free
</button>
</div>
</div>