-
Notifications
You must be signed in to change notification settings - Fork 0
getCSS - first implementation #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ameerabuf
wants to merge
28
commits into
master
Choose a base branch
from
get_css
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
6ed31bc
getCSS - first implementation
ameerabuf c8102db
fix build and lint
ameerabuf 094cbf7
Merge branch 'master' of github.com:wix-incubator/interact into get_css
ameerabuf f111288
gitignore
ameerabuf 9f34f35
wip
ameerabuf 36fd96e
Merge branch 'master' of github.com:wix-incubator/interact into get_css
ameerabuf b117e78
wip
ameerabuf 72b6f90
Merge branch 'master' of github.com:wix-incubator/interact into get_css
ameerabuf 8a0c428
wip
ameerabuf c030958
wip
ameerabuf f6917c1
wip
ameerabuf e084981
fixing conditions cascading logic and transitions
ameerabuf 38f5df3
updated tests
ameerabuf 1085c50
Merge branch 'master' of github.com:wix-incubator/interact into get_css
ameerabuf 005a624
PR comments
ameerabuf dc008a6
Merge branch 'master' into get_css
ameerabuf f280704
Merge branch 'get_css' of github.com:wix-incubator/interact into get_css
ameerabuf 54208db
Merge branch 'master' of github.com:wix-incubator/interact into get_css
ameerabuf a41f451
PR fixes
ameerabuf 29abbe8
PR fixes
ameerabuf bb114f4
infra changes
ameerabuf 1dfe84b
docs and demo - v1
ameerabuf a7d644d
docs and demo - v1
ameerabuf 39eca8e
Merge branch 'master' of github.com:wix-incubator/interact into get_css
ameerabuf fe20333
pr fixes
ameerabuf fe89e7c
Merge branch 'master' of github.com:wix-incubator/interact into get_css
ameerabuf 58c50d4
Merge branch 'master' of github.com:wix-incubator/interact into get_css
ameerabuf e51a7bc
yarn format
ameerabuf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,142 @@ | ||
| import { useState } from 'react'; | ||
| import type { InteractConfig } from '@wix/interact/web'; | ||
| import { Interact, generateCSS } from '@wix/interact/web'; | ||
|
|
||
| const demoConfig: InteractConfig = { | ||
| interactions: [ | ||
| { | ||
| key: 'css-demo-card-1', | ||
| trigger: 'viewEnter', | ||
| params: { type: 'once', threshold: 0.5 }, | ||
| effects: [ | ||
| { | ||
| keyframeEffect: { | ||
| name: 'fade-slide-up', | ||
| keyframes: [ | ||
| { opacity: 0, transform: 'translateX(-50vw)' }, | ||
| { opacity: 1, transform: 'translateX(0)' }, | ||
| ], | ||
| }, | ||
| duration: 600, | ||
| easing: 'cubic-bezier(0.16, 1, 0.3, 1)', | ||
| fill: 'backwards', | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| key: 'css-demo-card-2', | ||
| trigger: 'viewEnter', | ||
| params: { type: 'once', threshold: 0.5 }, | ||
| effects: [ | ||
| { | ||
| keyframeEffect: { | ||
| name: 'scale-fade-in', | ||
| keyframes: [ | ||
| { opacity: 0, transform: 'scale(0.9)' }, | ||
| { opacity: 1, transform: 'scale(1)' }, | ||
| ], | ||
| }, | ||
| duration: 500, | ||
| delay: 150, | ||
| easing: 'ease-out', | ||
| fill: 'backwards', | ||
| initial: { | ||
| opacity: '0', | ||
| }, | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| key: 'css-demo-card-3', | ||
| trigger: 'viewEnter', | ||
| params: { type: 'once', threshold: 0.5 }, | ||
| effects: [ | ||
| { | ||
| keyframeEffect: { | ||
| name: 'blur-reveal', | ||
| keyframes: [ | ||
| { opacity: 0.5, filter: 'blur(10px)', transform: 'translateX(-20px)' }, | ||
| { opacity: 1, filter: 'blur(0)', transform: 'translateX(0)' }, | ||
| ], | ||
| }, | ||
| duration: 700, | ||
| delay: 300, | ||
| easing: 'ease-out', | ||
| fill: 'backwards', | ||
| initial: false, | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| effects: {}, | ||
| }; | ||
|
|
||
| export const CSSGenerationDemo = () => { | ||
| const [showCSS, setShowCSS] = useState(true); | ||
|
|
||
| const generatedCSS = generateCSS(demoConfig); | ||
| Interact.create(demoConfig); | ||
|
|
||
| return ( | ||
| <section className="demo-section css-generation-demo"> | ||
| <style>{generatedCSS}</style> | ||
| <div className="demo-header"> | ||
| <h2>CSS Generation Demo</h2> | ||
| <p> | ||
| Use <code>generateCSS()</code> to pre-render animation CSS for SSR or efficient CSR. The | ||
| animations run as pure CSS when enabled, reducing JavaScript overhead. | ||
| </p> | ||
| </div> | ||
|
|
||
| <div className="demo-grid css-demo-cards"> | ||
| <interact-element data-interact-key="css-demo-card-1"> | ||
| <div className="panel demo-card"> | ||
| <p className="scroll-label">Card 1 - Fade Slide Up</p> | ||
| <h3>Entrance Animation</h3> | ||
| <p> | ||
| This card uses the default <code>initial</code> to set visibility to hidden and | ||
| transform to none before the viewEnter animation triggers to enable intersection. | ||
| </p> | ||
| </div> | ||
| </interact-element> | ||
|
|
||
| <interact-element data-interact-key="css-demo-card-2"> | ||
| <div className="panel demo-card"> | ||
| <p className="scroll-label">Card 2 - Scale Fade In</p> | ||
| <h3>Delayed Start</h3> | ||
| <p> | ||
| Custom <code>initial</code> on this card setting the opacity property ensures the card | ||
| starts transparent and invisible. | ||
| </p> | ||
| </div> | ||
| </interact-element> | ||
|
|
||
| <interact-element data-interact-key="css-demo-card-3"> | ||
| <div className="panel demo-card"> | ||
| <p className="scroll-label">Card 3 - Blur Reveal</p> | ||
| <h3>Complex Initial State</h3> | ||
| <p> | ||
| When <code>initial</code> is set to false, the first frame of the animation is set and | ||
| might affect intersection. | ||
| </p> | ||
| </div> | ||
| </interact-element> | ||
| </div> | ||
|
|
||
| <div className="demo-controls panel"> | ||
| <div className="control-group"> | ||
| <button className="toggle-css-btn" onClick={() => setShowCSS(!showCSS)}> | ||
| {showCSS ? 'Hide' : 'Show'} Generated CSS | ||
| </button> | ||
| </div> | ||
| </div> | ||
|
|
||
| {showCSS && ( | ||
| <div className="panel css-output"> | ||
| <p className="scroll-label">Generated CSS Output</p> | ||
| <pre>{generatedCSS || '/* No CSS generated */'}</pre> | ||
| </div> | ||
| )} | ||
| </section> | ||
| ); | ||
| }; | ||
This file contains hidden or 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 hidden or 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,142 @@ | ||
| import { useState } from 'react'; | ||
| import type { InteractConfig } from '@wix/interact/web'; | ||
| import { Interact, generateCSS } from '@wix/interact/web'; | ||
|
|
||
| const demoConfig: InteractConfig = { | ||
| interactions: [ | ||
| { | ||
| key: 'css-demo-card-1', | ||
| trigger: 'viewEnter', | ||
| params: { type: 'once', threshold: 0.5 }, | ||
| effects: [ | ||
| { | ||
| keyframeEffect: { | ||
| name: 'fade-slide-up', | ||
| keyframes: [ | ||
| { opacity: 0, transform: 'translateX(-50vw)' }, | ||
| { opacity: 1, transform: 'translateX(0)' }, | ||
| ], | ||
| }, | ||
| duration: 600, | ||
| easing: 'cubic-bezier(0.16, 1, 0.3, 1)', | ||
| fill: 'backwards', | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| key: 'css-demo-card-2', | ||
| trigger: 'viewEnter', | ||
| params: { type: 'once', threshold: 0.5 }, | ||
| effects: [ | ||
| { | ||
| keyframeEffect: { | ||
| name: 'scale-fade-in', | ||
| keyframes: [ | ||
| { opacity: 0, transform: 'scale(0.9)' }, | ||
| { opacity: 1, transform: 'scale(1)' }, | ||
| ], | ||
| }, | ||
| duration: 500, | ||
| delay: 150, | ||
| easing: 'ease-out', | ||
| fill: 'backwards', | ||
| initial: { | ||
| opacity: '0', | ||
| }, | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| key: 'css-demo-card-3', | ||
| trigger: 'viewEnter', | ||
| params: { type: 'once', threshold: 0.5 }, | ||
| effects: [ | ||
| { | ||
| keyframeEffect: { | ||
| name: 'blur-reveal', | ||
| keyframes: [ | ||
| { opacity: 0.5, filter: 'blur(10px)', transform: 'translateX(-20px)' }, | ||
| { opacity: 1, filter: 'blur(0)', transform: 'translateX(0)' }, | ||
| ], | ||
| }, | ||
| duration: 700, | ||
| delay: 300, | ||
| easing: 'ease-out', | ||
| fill: 'backwards', | ||
| initial: false, | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| effects: {}, | ||
| }; | ||
|
|
||
| export const CSSGenerationDemo = () => { | ||
| const [showCSS, setShowCSS] = useState(true); | ||
|
|
||
| const generatedCSS = generateCSS(demoConfig); | ||
| Interact.create(demoConfig); | ||
|
|
||
| return ( | ||
| <section className="demo-section css-generation-demo"> | ||
| <style>{generatedCSS}</style> | ||
| <div className="demo-header"> | ||
| <h2>CSS Generation Demo</h2> | ||
| <p> | ||
| Use <code>generateCSS()</code> to pre-render animation CSS for SSR or efficient CSR. The | ||
| animations run as pure CSS when enabled, reducing JavaScript overhead. | ||
| </p> | ||
| </div> | ||
|
|
||
| <div className="demo-grid css-demo-cards"> | ||
| <interact-element data-interact-key="css-demo-card-1"> | ||
| <div className="panel demo-card"> | ||
| <p className="scroll-label">Card 1 - Fade Slide Up</p> | ||
| <h3>Entrance Animation</h3> | ||
| <p> | ||
| This card uses the default <code>initial</code> to set visibility to hidden and | ||
| transform to none before the viewEnter animation triggers to enable intersection. | ||
| </p> | ||
| </div> | ||
| </interact-element> | ||
|
|
||
| <interact-element data-interact-key="css-demo-card-2"> | ||
| <div className="panel demo-card"> | ||
| <p className="scroll-label">Card 2 - Scale Fade In</p> | ||
| <h3>Delayed Start</h3> | ||
| <p> | ||
| Custom <code>initial</code> on this card setting the opacity property ensures the card | ||
| starts transparent and invisible. | ||
| </p> | ||
| </div> | ||
| </interact-element> | ||
|
|
||
| <interact-element data-interact-key="css-demo-card-3"> | ||
| <div className="panel demo-card"> | ||
| <p className="scroll-label">Card 3 - Blur Reveal</p> | ||
| <h3>Complex Initial State</h3> | ||
| <p> | ||
| When <code>initial</code> is set to false, the first frame of the animation is set and | ||
| might affect intersection. | ||
| </p> | ||
| </div> | ||
| </interact-element> | ||
| </div> | ||
|
|
||
| <div className="demo-controls panel"> | ||
| <div className="control-group"> | ||
| <button className="toggle-css-btn" onClick={() => setShowCSS(!showCSS)}> | ||
| {showCSS ? 'Hide' : 'Show'} Generated CSS | ||
| </button> | ||
| </div> | ||
| </div> | ||
|
|
||
| {showCSS && ( | ||
| <div className="panel css-output"> | ||
| <p className="scroll-label">Generated CSS Output</p> | ||
| <pre>{generatedCSS || '/* No CSS generated */'}</pre> | ||
| </div> | ||
| )} | ||
| </section> | ||
| ); | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.