Skip to content
This repository was archived by the owner on Apr 14, 2020. It is now read-only.

Commit b8d711b

Browse files
committed
feat: adds reveal reshaping container composite component
1 parent bc154a3 commit b8d711b

33 files changed

Lines changed: 750 additions & 121 deletions

File tree

README.md

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,40 @@
11
# yubaba
22

3-
is an element animation orchestrator for React.js ✨
3+
easy to use animations with powerful orchestration for React.js 🧙
44

5-
[![npm](https://img.shields.io/npm/v/yubaba.svg)](https://www.npmjs.com/package/yubaba)
6-
[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/yubaba.svg)](https://bundlephobia.com/result?p=yubaba)
5+
[![npm](https://img.shields.io/npm/v/yubaba.svg)](https://www.npmjs.com/package/yubaba) [![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/yubaba.svg)](https://bundlephobia.com/result?p=yubaba)
76

87
[![Example animation using yubaba](https://user-images.githubusercontent.com/6801309/55383683-87894b80-5574-11e9-80ef-7394eb6eca63.gif)](https://yubabajs.com/advanced-usage)
98

10-
## Why yubaba
9+
## What is yubaba???
1110

12-
`yubaba` is as much of a _platform_ as it is an **orchestrator**.
13-
It comes with prebuilt animations you can drop in and start using immediately,
14-
such as [ConcealMove](https://yubabajs.com/conceal-move) and [RevealMove](https://yubabajs.com/reveal-move) which together can [create an awesome user experience](https://yubabajs.com/advanced-usage) seen above!
11+
It's all about **animation** 🧙✨ - it can help with:
1512

16-
But even better you can create [_custom_ animations](https://yubabajs.com/custom-animations)!
17-
Using the same internals the [prebuilt animations use](https://yubabajs.com/getting-started),
18-
it comes with a first class customization experience for you to do,
19-
well,
20-
anything!
13+
- [Moving an element](https://yubabajs.com/move) from one position to another
14+
- [Revealing elements](https://yubabajs.com/reveal-move) like you see above
15+
- [Supporting animations](https://yubabajs.com/circle-expand) by obstructing elements in view; and
16+
- [Hiding children elements](https://yubabajs.com/baba-manager) until animations have completed to trick users 🤫
17+
- [Orchestrating](https://yubabajs.com/advanced-usage#wait-for-the-previous-animation-to-finish-before-starting-the-next) when animations should happen and [in what order](https://yubabajs.com/advanced-usage#controlling-in-what-order-animations-should-execute)
18+
- Composing animations together to create [composite animations](https://yubabajs.com/cross-fade-move)
19+
- [Anything you can imagine](https://yubabajs.com/custom-animations), seriously 🤩
2120

22-
## [Docs](https://yubabajs.com)
21+
## Installation
2322

24-
See the documentation at [yubabajs.com](https://yubabajs.com).
23+
`yubaba` has a peer dependency on [emotion](https://emotion.sh/docs/introduction) for some of the more advanced animations.
24+
25+
```bash
26+
npm install yubaba react@^16.4.x react-dom@^16.4.x emotion@^9.x.x --save
27+
```
28+
29+
or
30+
31+
```bash
32+
yarn add yubaba react@^16.4.x react-dom@^16.4.x emotion@^9.x.x
33+
```
34+
35+
## Next steps
36+
37+
- **First time** here? After installing head over to [Getting started](https://yubabajs.com/getting-started) to start learning the basics
38+
- Interested in **animating an element**? Check out [Focal animations](https://yubabajs.com/focal-animations)
39+
- For **ready made experiences** check out [Composite components](https://yubabajs.com/composite-components), just grab them and go!
40+
- Having **trouble**? Maybe [Troubleshooting](https://yubabajs.com/troubleshooting) has your answers

doczrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const pkg = require('./packages/yubaba/package.json');
22

33
module.exports = {
4-
title: 'yubaba docs',
4+
title: 'yubaba 🧙✨',
55
description: `yubaba ${pkg.description}`,
66
typescript: true,
77
dest: '/docs',

packages/yubaba/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"main": "dist/cjs/packages/yubaba/src/index.js",
88
"module": "dist/esm/packages/yubaba/src/index.js",
99
"sideEffects": false,
10-
"description": "is an element animation orchestrator for React.js ",
10+
"description": "easy to use animations with powerful orchestration for React.js 🧙",
1111
"keywords": [
1212
"react",
1313
"flip",

packages/yubaba/src/Collector/__docs__/docs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Collector
33
route: /collector
4-
menu: Utility Helpers
4+
menu: Utility helpers
55
---
66

77
import { Playground, PropsTable } from 'docz';

packages/yubaba/src/FocalTarget/__docs__/docs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: FocalTarget
33
route: /focal-target
4-
menu: Focal Animations
4+
menu: Focal animations
55
---
66

77
import { Playground, PropsTable } from 'docz';

packages/yubaba/src/Wait/__docs__/docs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Wait
33
route: /wait
4-
menu: Utility Helpers
4+
menu: Utility helpers
55
---
66

77
import { Playground, PropsTable } from 'docz';
Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: 1. Introduction
2+
name: 1. Introduction 📖
33
route: /
44
order: 5
55
---
@@ -8,36 +8,41 @@ import EmailChain from '../3-advanced-usage/EmailChain';
88

99
# yubaba
1010

11-
is an element animation orchestrator for React.js ✨
11+
easy to use animations with powerful orchestration for React.js 🧙
1212

1313
[![npm](https://img.shields.io/npm/v/yubaba.svg)](https://www.npmjs.com/package/yubaba) [![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/yubaba.svg)](https://bundlephobia.com/result?p=yubaba)
1414

1515
<EmailChain />
1616

17-
## Why yubaba?
17+
## What is yubaba???
1818

19-
`yubaba` is as much of a _platform_ as much as it is an **orchestrator**.
20-
It can control when, where, and how to start animations and comes with prebuilt animations you can drop in and start using immediately,
21-
such as [ConcealMove](/conceal-move) and [RevealMove](/reveal-move)!
19+
It's all about **animation** 🧙✨ - it can help with:
2220

23-
Even better you can create _custom_ animations!
24-
Using the same [internals](/collector) the [prebuilt animations use](https://github.com/madou/yubaba/tree/master/packages/yubaba/src/animations),
25-
it comes with a first class customization experience for you to do,
26-
well,
27-
anything!
21+
- [Moving an element](/move) from one position to another
22+
- [Revealing elements](/reveal-move) like you see above
23+
- [Supporting animations](/circle-expand) by obstructing elements in view; and
24+
- [Hiding children elements](/baba-manager) until animations have completed to trick users 🤫
25+
- [Orchestrating](/advanced-usage#wait-for-the-previous-animation-to-finish-before-starting-the-next) when animations should happen and [in what order](/advanced-usage#controlling-in-what-order-animations-should-execute)
26+
- Composing animations together to create [composite animations](/cross-fade-move)
27+
- [Anything you can imagine](/custom-animations), seriously 🤩
2828

2929
## Installation
3030

3131
`yubaba` has a peer dependency on [emotion](https://emotion.sh/docs/introduction) for some of the more advanced animations.
3232

3333
```bash
34-
npm install yubaba emotion@9.x.x --save
34+
npm install yubaba react@^16.4.x react-dom@^16.4.x emotion@^9.x.x --save
3535
```
3636

3737
or
3838

3939
```bash
40-
yarn add yubaba emotion@9.x.x
40+
yarn add yubaba react@^16.4.x react-dom@^16.4.x emotion@^9.x.x
4141
```
4242

43-
> **Tip -** After installing head over to [Getting started](/getting-started) to start learning the basics!
43+
## Next steps
44+
45+
- **First time** here? After installing head over to [Getting started](/getting-started) to start learning the basics
46+
- Interested in **animating an element**? Check out [Focal animations](/focal-animations)
47+
- For **ready made experiences** check out [Composite components](/composite-components), just grab them and go!
48+
- Having **trouble**? Maybe [Troubleshooting](/troubleshooting) has your answers

packages/yubaba/src/__docs__/2-getting-started/docs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: 2. Getting started
2+
name: 2. Getting started 🏃
33
route: /getting-started
44
order: 4
55
---

packages/yubaba/src/__docs__/3-advanced-usage/docs.mdx

Lines changed: 94 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: 3. Advanced usage
2+
name: 3. Advanced usage 😲
33
route: /advanced-usage
44
order: 3
55
---
@@ -39,12 +39,105 @@ import EmailChain from './EmailChain';
3939

4040
# Advanced usage
4141

42+
## Controlling in what order animations should execute
43+
44+
Animations are executed from top to bottom.
45+
The parent-most animation will be executed first and then continue execution inwards.
46+
47+
So if we had two animations, Move and CrossFade:
48+
49+
```js
50+
<Baba name="move-first">
51+
<Move>
52+
<CrossFade>{props => <div {...props} />}</CrossFade>
53+
</Move>
54+
</Baba>
55+
```
56+
57+
When executed the order would look like:
58+
59+
1. Move **beforeAnimate** fired
60+
1. CrossFade **beforeAnimate** fired
61+
1. Move **animate** fired
62+
1. CrossFade **animate** fired
63+
1. Move **afterAnimate** fired
64+
1. CrossFade **afterAnimate** fired
65+
66+
<br />
67+
68+
If we placed CrossFade first:
69+
70+
```js
71+
<Baba name="cross-fade-first">
72+
<CrossFade>
73+
<Move>{props => <div {...props} />}</Move>
74+
</CrossFade>
75+
</Baba>
76+
```
77+
78+
Then their order would be inversed:
79+
80+
1. CrossFade **beforeAnimate** fired
81+
1. Move **beforeAnimate** fired
82+
1. CrossFade **animate** fired
83+
1. Move **animate** fired
84+
1. CrossFade **afterAnimate** fired
85+
1. Move **afterAnimate** fired
86+
87+
## Wait for the previous animation to finish before starting the next
88+
89+
Depending on the animations chosen you'll want to defer starting one until the previous has finished.
90+
Luckily the [Wait](/wait) component has been made for that!
91+
92+
Continuing the example above,
93+
if we introduce the Wait component:
94+
95+
```js
96+
<Baba name="wait">
97+
<CrossFade>
98+
<Wait>
99+
<Move>{props => <div {...props} />}</Move>
100+
</Wait>
101+
</CrossFade>
102+
</Baba>
103+
```
104+
105+
Then the Move animation will wait for the CrossFade animation to complete finish before starting,
106+
the order then becoming:
107+
108+
1. CrossFade **beforeAnimate** fired
109+
1. CrossFade **animate** fired
110+
1. Move **beforeAnimate** fired
111+
1. Move **animate** fired
112+
1. CrossFade **afterAnimate** fired
113+
1. Move **afterAnimate** fired
114+
115+
> **Tip -** Notice that afterAnimate's are always called the the same regardless of Wait usage.
116+
42117
## Delay showing content until all animations have finished
43118

44119
Occasionally when initiating an animation we can have some secondary content we want to keep hidden until the animation has finished.
45120
Luckily [BabaManager](/baba-manager) exists to do just that!
46121
Make it a parent of any [Baba](/baba) and it will show its content only when the animation has finished.
47122

123+
```js
124+
<BabaManager>
125+
{manager => (
126+
<div>
127+
<Baba name="hide-children-until-animations-have-finished">
128+
<CrossFade>
129+
<Move>{props => <div {...props} />}</Move>
130+
</CrossFade>
131+
</Baba>
132+
133+
<span {...manager}>Children content</span>
134+
</div>
135+
)}
136+
</BabaManager>
137+
```
138+
139+
Children content will be shown after **all** animations have completed.
140+
48141
> **Tip -** If you have multiple child [Baba](/baba) you can pass [BabaManager](/baba-manager) a `name` prop to target a specific [Baba](/baba).
49142
50143
## Using supporting animations
@@ -97,14 +190,6 @@ used together can produce a really cool transition between states.
97190
> **Tip -** [BabaManager](/baba-manager) has been used as well to hide the next contents until the animation has finished,
98191
> resulting in that crisp transition.
99192
100-
## Wait for the previous animation to finish before starting the next
101-
102-
Depending on the animations chosen you'll want to defer starting one until the previous has finished.
103-
Luckily the [Wait](/wait) component has been made for that!
104-
105-
> **Tip -** Animations are executed from top to bottom.
106-
> The parent-most animation will be executed first and then continue execution inwards.
107-
108193
## Moving using a focal target
109194

110195
At times we want to move all content at once but have it originate from a focal point.

packages/yubaba/src/__docs__/4-custom-animations/docs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: 4. Custom animations
2+
name: 4. Custom animations 🎬
33
route: /custom-animations
44
order: 2
55
---

0 commit comments

Comments
 (0)