Skip to content

Commit 5c691a1

Browse files
authored
Merge pull request #32 from inokawa/fix-reverse
Fix behavior of reverse
2 parents ad4adc7 + 5401965 commit 5c691a1

File tree

10 files changed

+53
-107
lines changed

10 files changed

+53
-107
lines changed

docs/API.md

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99
- [GetKeyframeFunction](API.md#getkeyframefunction)
1010
- [AnimatableCSSProperties](API.md#animatablecssproperties)
1111
- [PlayOptions](API.md#playoptions)
12-
- [ReverseOptions](API.md#reverseoptions)
1312
- [WaitingAnimationEventName](API.md#waitinganimationeventname)
1413
- [PlayArgs](API.md#playargs)
15-
- [ReverseArgs](API.md#reverseargs)
1614
- [ComputedTimingContext](API.md#computedtimingcontext)
1715
- [AnimationFunction](API.md#animationfunction)
1816
- [TransitionAnimationDefinition](API.md#transitionanimationdefinition)
@@ -43,7 +41,7 @@ Strictly typed [Keyframe](https://developer.mozilla.org/en-US/docs/Web/API/Web_A
4341

4442
#### Defined in
4543

46-
[src/core/waapi.ts:17](https://github.com/inokawa/react-animatable/blob/4002988/src/core/waapi.ts#L17)
44+
[src/core/waapi.ts:17](https://github.com/inokawa/react-animatable/blob/d75db13/src/core/waapi.ts#L17)
4745

4846
___
4947

@@ -53,7 +51,7 @@ ___
5351

5452
#### Defined in
5553

56-
[src/core/waapi.ts:20](https://github.com/inokawa/react-animatable/blob/4002988/src/core/waapi.ts#L20)
54+
[src/core/waapi.ts:20](https://github.com/inokawa/react-animatable/blob/d75db13/src/core/waapi.ts#L20)
5755

5856
___
5957

@@ -73,7 +71,7 @@ A function to define keyframe dynamically
7371

7472
#### Defined in
7573

76-
[src/core/waapi.ts:29](https://github.com/inokawa/react-animatable/blob/4002988/src/core/waapi.ts#L29)
74+
[src/core/waapi.ts:29](https://github.com/inokawa/react-animatable/blob/d75db13/src/core/waapi.ts#L29)
7775

7876
___
7977

@@ -83,7 +81,7 @@ ___
8381

8482
#### Defined in
8583

86-
[src/core/waapi.ts:4](https://github.com/inokawa/react-animatable/blob/4002988/src/core/waapi.ts#L4)
84+
[src/core/waapi.ts:4](https://github.com/inokawa/react-animatable/blob/d75db13/src/core/waapi.ts#L4)
8785

8886
___
8987

@@ -99,17 +97,7 @@ ___
9997

10098
#### Defined in
10199

102-
[src/core/waapi.ts:83](https://github.com/inokawa/react-animatable/blob/4002988/src/core/waapi.ts#L83)
103-
104-
___
105-
106-
### ReverseOptions
107-
108-
Ƭ **ReverseOptions**: `Object`
109-
110-
#### Defined in
111-
112-
[src/core/waapi.ts:85](https://github.com/inokawa/react-animatable/blob/4002988/src/core/waapi.ts#L85)
100+
[src/core/waapi.ts:83](https://github.com/inokawa/react-animatable/blob/d75db13/src/core/waapi.ts#L83)
113101

114102
___
115103

@@ -119,7 +107,7 @@ ___
119107

120108
#### Defined in
121109

122-
[src/core/waapi.ts:140](https://github.com/inokawa/react-animatable/blob/4002988/src/core/waapi.ts#L140)
110+
[src/core/waapi.ts:139](https://github.com/inokawa/react-animatable/blob/d75db13/src/core/waapi.ts#L139)
123111

124112
___
125113

@@ -135,23 +123,7 @@ ___
135123

136124
#### Defined in
137125

138-
[src/react/hooks/useAnimation.ts:24](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L24)
139-
140-
___
141-
142-
### ReverseArgs
143-
144-
Ƭ **ReverseArgs**<`Args`\>: `Args` extends `void` ? [ReverseOptions?] : [`Expand`<[`ReverseOptions`](API.md#reverseoptions) & `Args` extends `void` ? {} : { `args`: `Args` }\>]
145-
146-
#### Type parameters
147-
148-
| Name | Type |
149-
| :------ | :------ |
150-
| `Args` | `void` |
151-
152-
#### Defined in
153-
154-
[src/react/hooks/useAnimation.ts:28](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L28)
126+
[src/react/hooks/useAnimation.ts:23](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimation.ts#L23)
155127

156128
___
157129

@@ -163,7 +135,7 @@ Non nullable [ComputedEffectTiming](https://developer.mozilla.org/en-US/docs/Web
163135

164136
#### Defined in
165137

166-
[src/react/hooks/useAnimationFunction.ts:29](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimationFunction.ts#L29)
138+
[src/react/hooks/useAnimationFunction.ts:29](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimationFunction.ts#L29)
167139

168140
___
169141

@@ -184,7 +156,7 @@ In this callback you can update any state or ref in JS.
184156

185157
#### Defined in
186158

187-
[src/react/hooks/useAnimationFunction.ts:41](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimationFunction.ts#L41)
159+
[src/react/hooks/useAnimationFunction.ts:41](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimationFunction.ts#L41)
188160

189161
___
190162

@@ -194,7 +166,7 @@ ___
194166

195167
#### Defined in
196168

197-
[src/react/hooks/useTransitionAnimation.ts:23](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useTransitionAnimation.ts#L23)
169+
[src/react/hooks/useTransitionAnimation.ts:23](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useTransitionAnimation.ts#L23)
198170

199171
## Functions
200172

@@ -216,7 +188,7 @@ A component to manage enter/update/exit of its children by key, that works simil
216188

217189
#### Defined in
218190

219-
[src/react/components/TransitionGroup.tsx:74](https://github.com/inokawa/react-animatable/blob/4002988/src/react/components/TransitionGroup.tsx#L74)
191+
[src/react/components/TransitionGroup.tsx:74](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/components/TransitionGroup.tsx#L74)
220192

221193
___
222194

@@ -245,7 +217,7 @@ A basic hook to use Web Animations API. See [AnimationHandle](interfaces/Animati
245217

246218
#### Defined in
247219

248-
[src/react/hooks/useAnimation.ts:92](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L92)
220+
[src/react/hooks/useAnimation.ts:87](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimation.ts#L87)
249221

250222
___
251223

@@ -274,7 +246,7 @@ Same as [useAnimation](API.md#useanimation), but it drives function not React el
274246

275247
#### Defined in
276248

277-
[src/react/hooks/useAnimationFunction.ts:68](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimationFunction.ts#L68)
249+
[src/react/hooks/useAnimationFunction.ts:68](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimationFunction.ts#L68)
278250

279251
___
280252

@@ -300,4 +272,4 @@ This hook must be used under [TransitionGroup](API.md#transitiongroup) component
300272

301273
#### Defined in
302274

303-
[src/react/hooks/useTransitionAnimation.ts:33](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useTransitionAnimation.ts#L33)
275+
[src/react/hooks/useTransitionAnimation.ts:33](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useTransitionAnimation.ts#L33)

docs/interfaces/AnimationFunctionHandle.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,26 +55,20 @@ A wrapper of Web Animations API's [play](https://developer.mozilla.org/en-US/doc
5555

5656
#### Defined in
5757

58-
[src/react/hooks/useAnimation.ts:36](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L36)
58+
[src/react/hooks/useAnimation.ts:31](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimation.ts#L31)
5959

6060
___
6161

6262
### reverse
6363

64-
**reverse**: (...`opts`: [`ReverseArgs`](../API.md#reverseargs)<`Args`\>) => [`BaseAnimationHandle`](BaseAnimationHandle.md)<`Args`\>
64+
**reverse**: () => [`BaseAnimationHandle`](BaseAnimationHandle.md)<`Args`\>
6565

6666
#### Type declaration
6767

68-
▸ (...`opts`): [`BaseAnimationHandle`](BaseAnimationHandle.md)<`Args`\>
68+
▸ (): [`BaseAnimationHandle`](BaseAnimationHandle.md)<`Args`\>
6969

7070
A wrapper of Web Animations API's [reverse](https://developer.mozilla.org/en-US/docs/Web/API/Animation/reverse).
7171

72-
##### Parameters
73-
74-
| Name | Type |
75-
| :------ | :------ |
76-
| `...opts` | [`ReverseArgs`](../API.md#reverseargs)<`Args`\> |
77-
7872
##### Returns
7973

8074
[`BaseAnimationHandle`](BaseAnimationHandle.md)<`Args`\>
@@ -85,7 +79,7 @@ A wrapper of Web Animations API's [reverse](https://developer.mozilla.org/en-US/
8579

8680
#### Defined in
8781

88-
[src/react/hooks/useAnimation.ts:40](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L40)
82+
[src/react/hooks/useAnimation.ts:35](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimation.ts#L35)
8983

9084
___
9185

@@ -109,7 +103,7 @@ A wrapper of Web Animations API's [cancel](https://developer.mozilla.org/en-US/d
109103

110104
#### Defined in
111105

112-
[src/react/hooks/useAnimation.ts:44](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L44)
106+
[src/react/hooks/useAnimation.ts:39](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimation.ts#L39)
113107

114108
___
115109

@@ -133,7 +127,7 @@ A wrapper of Web Animations API's [finish](https://developer.mozilla.org/en-US/d
133127

134128
#### Defined in
135129

136-
[src/react/hooks/useAnimation.ts:48](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L48)
130+
[src/react/hooks/useAnimation.ts:43](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimation.ts#L43)
137131

138132
___
139133

@@ -157,7 +151,7 @@ A wrapper of Web Animations API's [pause](https://developer.mozilla.org/en-US/do
157151

158152
#### Defined in
159153

160-
[src/react/hooks/useAnimation.ts:52](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L52)
154+
[src/react/hooks/useAnimation.ts:47](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimation.ts#L47)
161155

162156
___
163157

@@ -187,7 +181,7 @@ A setter of Web Animations API's [currentTime](https://developer.mozilla.org/en-
187181

188182
#### Defined in
189183

190-
[src/react/hooks/useAnimation.ts:56](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L56)
184+
[src/react/hooks/useAnimation.ts:51](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimation.ts#L51)
191185

192186
___
193187

@@ -219,7 +213,7 @@ If you pass function, you can get current playbackRate from its argument.
219213

220214
#### Defined in
221215

222-
[src/react/hooks/useAnimation.ts:62](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L62)
216+
[src/react/hooks/useAnimation.ts:57](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimation.ts#L57)
223217

224218
___
225219

@@ -252,4 +246,4 @@ A getter of Promise that will be resolved in specified timing.
252246

253247
#### Defined in
254248

255-
[src/react/hooks/useAnimation.ts:71](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L71)
249+
[src/react/hooks/useAnimation.ts:66](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimation.ts#L66)

docs/interfaces/AnimationHandle.md

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ You have to pass this callback to ref of element you want to control.
3232

3333
#### Defined in
3434

35-
[src/react/hooks/useAnimation.ts:85](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L85)
35+
[src/react/hooks/useAnimation.ts:80](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimation.ts#L80)
3636

3737
## Table of contents
3838

@@ -75,26 +75,20 @@ A wrapper of Web Animations API's [play](https://developer.mozilla.org/en-US/doc
7575

7676
#### Defined in
7777

78-
[src/react/hooks/useAnimation.ts:36](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L36)
78+
[src/react/hooks/useAnimation.ts:31](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimation.ts#L31)
7979

8080
___
8181

8282
### reverse
8383

84-
**reverse**: (...`opts`: [`ReverseArgs`](../API.md#reverseargs)<`Args`\>) => [`BaseAnimationHandle`](BaseAnimationHandle.md)<`Args`\>
84+
**reverse**: () => [`BaseAnimationHandle`](BaseAnimationHandle.md)<`Args`\>
8585

8686
#### Type declaration
8787

88-
▸ (...`opts`): [`BaseAnimationHandle`](BaseAnimationHandle.md)<`Args`\>
88+
▸ (): [`BaseAnimationHandle`](BaseAnimationHandle.md)<`Args`\>
8989

9090
A wrapper of Web Animations API's [reverse](https://developer.mozilla.org/en-US/docs/Web/API/Animation/reverse).
9191

92-
##### Parameters
93-
94-
| Name | Type |
95-
| :------ | :------ |
96-
| `...opts` | [`ReverseArgs`](../API.md#reverseargs)<`Args`\> |
97-
9892
##### Returns
9993

10094
[`BaseAnimationHandle`](BaseAnimationHandle.md)<`Args`\>
@@ -105,7 +99,7 @@ A wrapper of Web Animations API's [reverse](https://developer.mozilla.org/en-US/
10599

106100
#### Defined in
107101

108-
[src/react/hooks/useAnimation.ts:40](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L40)
102+
[src/react/hooks/useAnimation.ts:35](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimation.ts#L35)
109103

110104
___
111105

@@ -129,7 +123,7 @@ A wrapper of Web Animations API's [cancel](https://developer.mozilla.org/en-US/d
129123

130124
#### Defined in
131125

132-
[src/react/hooks/useAnimation.ts:44](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L44)
126+
[src/react/hooks/useAnimation.ts:39](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimation.ts#L39)
133127

134128
___
135129

@@ -153,7 +147,7 @@ A wrapper of Web Animations API's [finish](https://developer.mozilla.org/en-US/d
153147

154148
#### Defined in
155149

156-
[src/react/hooks/useAnimation.ts:48](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L48)
150+
[src/react/hooks/useAnimation.ts:43](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimation.ts#L43)
157151

158152
___
159153

@@ -177,7 +171,7 @@ A wrapper of Web Animations API's [pause](https://developer.mozilla.org/en-US/do
177171

178172
#### Defined in
179173

180-
[src/react/hooks/useAnimation.ts:52](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L52)
174+
[src/react/hooks/useAnimation.ts:47](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimation.ts#L47)
181175

182176
___
183177

@@ -207,7 +201,7 @@ A setter of Web Animations API's [currentTime](https://developer.mozilla.org/en-
207201

208202
#### Defined in
209203

210-
[src/react/hooks/useAnimation.ts:56](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L56)
204+
[src/react/hooks/useAnimation.ts:51](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimation.ts#L51)
211205

212206
___
213207

@@ -239,7 +233,7 @@ If you pass function, you can get current playbackRate from its argument.
239233

240234
#### Defined in
241235

242-
[src/react/hooks/useAnimation.ts:62](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L62)
236+
[src/react/hooks/useAnimation.ts:57](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimation.ts#L57)
243237

244238
___
245239

@@ -272,4 +266,4 @@ A getter of Promise that will be resolved in specified timing.
272266

273267
#### Defined in
274268

275-
[src/react/hooks/useAnimation.ts:71](https://github.com/inokawa/react-animatable/blob/4002988/src/react/hooks/useAnimation.ts#L71)
269+
[src/react/hooks/useAnimation.ts:66](https://github.com/inokawa/react-animatable/blob/d75db13/src/react/hooks/useAnimation.ts#L66)

docs/interfaces/AnimationOptions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Extended [options of KeyframeEffect](https://developer.mozilla.org/en-US/docs/We
3333

3434
#### Defined in
3535

36-
[src/core/waapi.ts:38](https://github.com/inokawa/react-animatable/blob/4002988/src/core/waapi.ts#L38)
36+
[src/core/waapi.ts:38](https://github.com/inokawa/react-animatable/blob/d75db13/src/core/waapi.ts#L38)
3737

3838
___
3939

0 commit comments

Comments
 (0)