-
Notifications
You must be signed in to change notification settings - Fork 886
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
experimental: Text Animation storybook (#4938)
# Description This PR introduces prototypes for a set of versatile animation components: • AnimateProxy: A wrapper component supporting staggered animations and integrations with third-party animation engines. • AnimateTextProgress: Demonstrates per-character staggered text animations. 👉 [View Storybook Preview](https://6382151c8b47d4399fb9fc69-uyomckzwfj.chromatic.com/iframe.html?args=&globals=&id=sdk-components-animation-animate-proxy--in-out&viewMode=story) Features • Added Storybook examples showcasing text animation capabilities. • Supports custom CSS properties within keyframes for enhanced animation flexibility. Upcoming PRs Future PRs will introduce more specialized animation components utilizing the AnimateProxy: ```jsx // Example usage of AnimateText <AnimateProxy> {($progress, getStylesAt) => ( <AnimateTextProgress $progress={$progress} getStylesAt={getStylesAt} charWindow={50} easing="easeInQuart" > {children} </AnimateTextProgress> )} </AnimateProxy> // Example usage of AnimateStager <AnimateProxy> {($progress, getStylesAt) => ( <Stager $progress={$progress} getStylesAt={getStylesAt} // Additional props... /> )} </AnimateProxy> // Example usage of AnimateLottie <AnimateProxy> {($progress, getStylesAt) => ( <Lottie $progress={$progress} getStylesAt={getStylesAt} // Additional props... /> )} </AnimateProxy> ``` See corresponding PR: (link to be added) ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 0000) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
- Loading branch information
Showing
12 changed files
with
99 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule private-src
updated
from c1053a to 45acad
10 changes: 10 additions & 0 deletions
10
packages/sdk-components-animation/src/__generated__/animate-children.props.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
packages/sdk-components-animation/src/__generated__/animate-text.props.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { forwardRef, type ElementRef } from "react"; | ||
|
||
const easings = { | ||
linear: true, | ||
easeIn: true, | ||
easeInCubic: true, | ||
easeInQuart: true, | ||
easeOut: true, | ||
easeOutCubic: true, | ||
easeOutQuart: true, | ||
ease: true, | ||
easeInOutCubic: true, | ||
easeInOutQuart: true, | ||
}; | ||
|
||
type AnimateChildrenProps = { | ||
charWindow: number; | ||
easing: keyof typeof easings; | ||
children: React.ReactNode; | ||
}; | ||
|
||
export const AnimateText = forwardRef<ElementRef<"div">, AnimateChildrenProps>( | ||
({ charWindow: _, easing: __, ...props }, ref) => { | ||
return <div ref={ref} {...props} />; | ||
} | ||
); | ||
|
||
const displayName = "AnimateText"; | ||
AnimateText.displayName = displayName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { TextIcon } from "@webstudio-is/icons/svg"; | ||
import type { WsComponentMeta, WsComponentPropsMeta } from "@webstudio-is/sdk"; | ||
import { props } from "./__generated__/animate-text.props"; | ||
|
||
export const meta: WsComponentMeta = { | ||
category: "general", | ||
type: "container", | ||
description: "Animate Text", | ||
icon: TextIcon, | ||
order: 6, | ||
label: "Animate Text", | ||
}; | ||
|
||
export const propsMeta: WsComponentPropsMeta = { | ||
props, | ||
initialProps: ["charWindow", "easing"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { AnimateChildren } from "./animate-children"; | ||
export { AnimateText } from "./animate-text"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { meta as AnimateChildren } from "./scroll.ws"; | ||
export { meta as AnimateChildren } from "./animate-children.ws"; | ||
export { meta as AnimateText } from "./animate-text.ws"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { propsMeta as AnimateChildren } from "./scroll.ws"; | ||
export { propsMeta as AnimateChildren } from "./animate-children.ws"; | ||
export { propsMeta as AnimateText } from "./animate-text.ws"; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.