generated from argyleink/shortstack
-
Notifications
You must be signed in to change notification settings - Fork 129
Add a transition
Adam Argyle edited this page Sep 30, 2020
·
4 revisions
- Write transition
- Include the transition in the library bundle(s)
- Include the transition in the Svelte docsite
Goal: Have a fun easy place to test a transition and prepare for annoying library integrations.
- Sandbox for getting started https://codepen.io/argyleink/pen/RwamzKX
- Look to see which shape type your transition fits into (circle, square, polygon or wipe)
- Isolate the stateful custom properties you need
- Create your 2 keyframe animations (in and out)
- Have a nice working demo that can be toggled in and out
- ~2 custom properties with your clip paths in them
- 2 keyframe animations using your custom properties
- name are consistent with each other and the rest of the library
Goal: Put all the picky named things into their picky named locations
- Fork this repo!
- Find the applicable shape folder in
transition.css/src/
- Add your custom properties to the
_vars.css
file in that directory - Create 2 new files:
src/${shape}/in-${your_transition}.css
&src/${shape}/out-${your_transition}.css
- Paste the following template into each file and replace the names with yours:
@keyframes shape-state-name {
from {
clip-path: var(--your-property1);
}
to {
clip-path: var(--your-property2);
}
}
[transition-style="state:shape:name"] {
animation-name: shape-state-name;
}
- Add your animation keyframes to your new files
- Add your 2 new files to
_includes.css
- Create a pull request to the
main
branch with your new transition!
Goal: Include your new transition in transition.style
- Checkout the
svelte
branch - Open
svelte-docsite/src/transitions.js
and add your transitions to the list - Run
npm run dev
and visitlocalhost:5000
to verify your transition is listed - Create a pull request to the
svelte
branch!
Transition docsite uses the CDN version of this library, so in order to try your transition in the docsite, open
svelte-docsite/public/index.html
and point the import to a build of yours.