Replies: 4 comments 1 reply
-
@DavidHDev Hi, may I request your help when you're free? |
Beta Was this translation helpful? Give feedback.
-
@fr1g A video of what the animation looks like right now would probably help. Please know that the component ONLY provides the letters rotating, not the full container animations as well. In the React Bits project, it's added separately with some extra logic and extra CSS: So this is the only part is what the actual component provides, not all the transitions: Demo Code: <div className="rotating-text-demo">
<LayoutGroup>
<motion.p className="rotating-text-ptag" layout>
<motion.span
className="pt-0.5 sm:pt-1 md:pt-2"
layout
transition={{ type: "spring", damping: 30, stiffness: 400 }}
>
Creative{" "}
</motion.span>
<RotatingText
texts={words}
mainClassName="rotating-text-main"
staggerFrom={"last"}
initial={{ y: "100%" }}
animate={{ y: 0 }}
exit={{ y: "-120%" }}
staggerDuration={0.025}
splitLevelClassName="rotating-text-split"
transition={{ type: "spring", damping: 30, stiffness: 400 }}
rotationInterval={2000}
/>
</motion.p>
</LayoutGroup>
</div> CSS for demo code: .rotating-text-demo {
width: 100%;
height: 100%;
font-size: 1.5rem;
line-height: 2rem;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
font-weight: 300;
overflow: hidden;
padding: 3rem;
color: #fff;
}
.rotating-text-main {
padding-left: 0.5rem;
padding-right: 0.5rem;
padding-top: 0.125rem;
padding-bottom: 0.125rem;
background-color: #67e8f9;
color: #000;
overflow: hidden;
display: flex;
justify-content: center;
border-radius: 0.5rem;
}
.rotating-text-split {
overflow: hidden;
padding-bottom: 0.125rem;
}
.rotating-text-ptag {
font-weight: 900;
display: flex;
align-items: center;
gap: 0.2em;
}
@media (min-width: 640px) {
.rotating-text-split {
padding-bottom: 0.25rem;
}
}
@media (min-width: 640px) {
.rotating-text-main {
padding-top: 0.25rem;
padding-bottom: 0.25rem;
}
}
@media (min-width: 768px) {
.rotating-text-main {
padding-left: 0.75rem;
padding-right: 0.75rem;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
}
}
@media (min-width: 640px) {
.rotating-text-demo {
font-size: 1.875rem;
line-height: 2.25rem;
padding: 5rem;
}
}
@media (min-width: 768px) {
.rotating-text-demo {
font-size: 3rem;
line-height: 1;
padding: 6rem;
}
}
@media (prefers-color-scheme: dark) {
.rotating-text-demo {
color: var(--muted);
}
} |
Beta Was this translation helpful? Give feedback.
-
@fr1g of course it won't work without all the extra css I also provided above. Again, the RotatingText component is ONLY meant to help you handle the rotation animation, not the container styles as well, so everything else is in your hands. |
Beta Was this translation helpful? Give feedback.
-
in this case, could you please teach me how to make the box animation as your demo?发自我的 iPhone在 2025年2月18日,12:35,David ***@***.***> 写道:
@fr1g of course it won't work without all the extra css I also provided above. Again, the RotatingText component is ONLY meant to help you handle the rotation animation, not the container styles as well, so everything else is in your hands.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
But at the very first, I need to confirm, that theoretically, the given code in the usage section is what should be rendered like the preview section going, right?


Now if so, I copied the given code to my project but the box that containing the text (let's say, the badge) shrinks to the shorter texts' width but without animation like the preview section.
Meanwhile I can see the animation is controlled by js, but how the site working like:
and my project will belike:
just like, there's only transition popping each character up, but nothing controlling the transform of badge.
here's my dependencies installed:
Beta Was this translation helpful? Give feedback.
All reactions