Skip to content

Commit

Permalink
V3 (#45)
Browse files Browse the repository at this point in the history
* working on v3

* more update animation key frames

* update with animate key frames

* working on aniamteGroup

* draft version

* update

* delete unused files

* delete unused files

* fixing useAnimate

* fixing useAnimate

* update all the hooks

* update

* covert to flow to typescript

* get it working with typescript

* remove all unit tests

* fix types

* type clean up

* move type update

* fix bug on animate group

* update on unit tests

* more unit tests update

* unit test for animateGroup

* unit test for AnimateKeyFrames

* useAnimateGroup

* testing on useAnimateGroup

* working version with useAnimateGroup

* fix unit test

* fix unit test

* unit test for useAnimateGroup

* update readme

* update readme

* update readme

* update readme
  • Loading branch information
bluebill1049 committed May 15, 2019
1 parent c67c820 commit 94a59f8
Show file tree
Hide file tree
Showing 67 changed files with 2,641 additions and 4,857 deletions.
8 changes: 0 additions & 8 deletions .babelrc

This file was deleted.

26 changes: 0 additions & 26 deletions .eslintrc

This file was deleted.

11 changes: 11 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,11 @@
module.exports = {
parser: '@typescript-eslint/parser',
extends: ['plugin:@typescript-eslint/recommended'],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
rules: {
'@typescript-eslint/indent': 'off'
},
};
12 changes: 0 additions & 12 deletions .flowconfig

This file was deleted.

4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -61,6 +61,8 @@ typings/

.DS_Store

/dist
/lib
.idea/
.coveralls.yml
.coveralls.yml
.rpt2_cache/
88 changes: 67 additions & 21 deletions README.md
Expand Up @@ -24,35 +24,81 @@

## Quickstart

```jsx
import react from 'react';
import { Animate, AnimateKeyframes, AnimateGroup } from 'react-simple-animate';
#### Components

const props = {
startStyle: { opacity: 0 }
endStyle: { opacity: 1 }
};
```jsx
import React from "react";
import { Animate, AnimateKeyframes, AnimateGroup } from "react-simple-animate";

export default () => {
return (
// This example demonstrate animate individual element.
<Animate play {...props}>
export default () => (
<>
{/* This example demonstrate animate individual element. */}
<Animate play start={{ opacity: 0 }} end={{ opacity: 1 }}>
<h1>React simple animate</h1>
</Animate>

// This example demonstrate animate keyframes with individual element.
<AnimateKeyframes play iterationCount="infinite" keyframes={['opacity: 0', 'opacity: 1']}>
{/* This example demonstrate animate keyframes with individual element. */}
<AnimateKeyframes
play
iterationCount="infinite"
keyframes={["opacity: 0", "opacity: 1"]}
>
<h1>React simple animate with keyframes</h1>
</AnimateKeyframes>

// This example demonstrate animate group of animation with sequenceIndex.
{/* This example demonstrate animate group of animation with sequenceIndex. */}
<AnimateGroup play>
<Animate {...props} sequenceIndex={0} />
<p>Next animation below: </p>
<Animate {...props} sequenceIndex={1} />
<p>Final animation below: </p>
<Animate {...props} sequenceIndex={2} />
<Animate start={{ opacity: 0 }} end={{ opacity: 1 }} sequenceIndex={0}>
first
</Animate>

<Animate start={{ opacity: 0 }} end={{ opacity: 1 }} sequenceIndex={1}>
second
</Animate>
<Animate start={{ opacity: 0 }} end={{ opacity: 1 }} sequenceIndex={2}>
third
</Animate>
</AnimateGroup>
</>
);

```

#### Hooks

```jsx
import react from 'react';
import { useAnimate, useAnimateKeyframes, useAnimateGroup } from 'react-simple-animate';

export const useAnimateExample = () => {
const { style, play } = useAnimate({ start: { opacity: 0 }, end: { opacity: 1 } });

useEffect(() => play(true), []);

return <div style={style}>useAnimate</div>;
};

export const useAnimateKeyframesExample = () => {
const { style, play } = useAnimateKeyframes({
keyframes: ['opacity: 0', 'opacity: 1'],
iterationCount: 4
});

useEffect(() => play(true), []);

return <div style={style}>useAnimate</div>;
};

export const useAnimateGroup = () => {
const { styles = [], play } = useAnimateGroup({
sequences: [
{ start: { opacity: 1 }, end: { opacity: 0 } },
{ start: { background: "red" }, end: { background: "blue" } }
]
});

useEffect(() => play(true), []);

return (
{styles.map(style => <div style={style}>useAnimateGroup</div>)}
);
};
```
Expand Down
130 changes: 0 additions & 130 deletions index.d.ts

This file was deleted.

15 changes: 15 additions & 0 deletions jest.config.js
@@ -0,0 +1,15 @@
module.exports = {
roots: ['<rootDir>/src'],
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
globals: {
'ts-jest': {
tsConfig: 'tsconfig.jest.json',
},
},
testMatch: ['**/?(*.)+(spec|test).ts?(x)'],
transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$'],
setupFiles: ['<rootDir>/setup.ts'],
moduleFileExtensions: ['ts', 'tsx', 'js'],
};
3 changes: 0 additions & 3 deletions jestConfig.json

This file was deleted.

0 comments on commit 94a59f8

Please sign in to comment.