9 |
--------------------------------------------------------------------------------
/docs/demo/simple.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: simple
3 | order: 0
4 | ---
5 |
6 | ## basic
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demo/type.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: api:type
3 | order: 4
4 | ---
5 |
6 | ## type use
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demo/control.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: control
3 | order: 1
4 | ---
5 |
6 | ## control
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/plugin/SvgDrawPlugin.ts:
--------------------------------------------------------------------------------
1 | import SvgDrawPlugin from 'tween-one/es/plugins/SvgDrawPlugin';
2 |
3 | export default SvgDrawPlugin;
4 |
--------------------------------------------------------------------------------
/docs/demo/animParam.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: anim-params
3 | order: 2
4 | ---
5 |
6 | ## anim-params
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/plugin/PathMotionPlugin.ts:
--------------------------------------------------------------------------------
1 | import PathMotionPlugin from 'tween-one/es/plugins/PathMotionPlugin';
2 |
3 | export default PathMotionPlugin;
4 |
--------------------------------------------------------------------------------
/docs/demo/component.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: api:component
3 | order: 4
4 | ---
5 |
6 | ## component
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demo/plugin-svg-draw.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: plugin:svg-draw
3 | order: 7
4 | ---
5 |
6 | ## svg-draw
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demo/plugin-svg-morph.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: plugin:svg-morph
3 | order: 7
4 | ---
5 |
6 | ## svg-morph
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demo/resetStyle.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: api:resetStyle
3 | order: 4
4 | ---
5 |
6 | ## type use
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demo/followMouse.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: follow-mouse
3 | order: 5
4 | ---
5 |
6 | ## follow mouse
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demo/group:useInTable.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: useInTable
3 | order: 8
4 | ---
5 |
6 | ## use in table
7 |
8 |
9 |
--------------------------------------------------------------------------------
/typings/global/import.d.ts:
--------------------------------------------------------------------------------
1 | import * as CSS from 'csstype';
2 | declare module 'csstype' {
3 | interface Properties {
4 | [key: string]: any;
5 | }
6 | }
--------------------------------------------------------------------------------
/docs/demo/plugin-path-motion.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: plugin:path-motion
3 | order: 7
4 | ---
5 |
6 | ## path-motion
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demo/componentFragment.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: api:componentFragment
3 | order: 4
4 | ---
5 |
6 | ## component
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demo/plugin-number-dance.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: plugin:number-dance
3 | order: 7
4 | ---
5 |
6 | ## number-dance
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demo/blurFilter.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: filter
3 | order: 3
4 | ---
5 |
6 | ## css filter
7 |
8 | css filter animate
9 |
10 |
11 |
--------------------------------------------------------------------------------
/docs/demo/easingPath.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: api:easing-path
3 | order: 4
4 | ---
5 |
6 | ## easingPath
7 |
8 | ease path
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.fatherrc.js:
--------------------------------------------------------------------------------
1 |
2 | export default {
3 | cjs: 'babel',
4 | esm: { type: 'babel', importLibToEs: true },
5 | runtimeHelpers: true,
6 | preCommit: {
7 | eslint: true,
8 | prettier: true,
9 | },
10 | };
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "singleQuote": true,
3 | "trailingComma": "all",
4 | "printWidth": 100,
5 | "overrides": [
6 | {
7 | "files": ".prettierrc",
8 | "options": { "parser": "json" }
9 | }
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/now.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 2,
3 | "name": "rc-tween-one",
4 | "builds": [
5 | {
6 | "src": "package.json",
7 | "use": "@now/static-build",
8 | "config": { "distDir": ".doc" }
9 | }
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # http://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | charset = utf-8
9 | trim_trailing_whitespace = true
10 | insert_final_newline = true
11 |
12 | [*.md]
13 | trim_trailing_whitespace = false
14 |
15 | [Makefile]
16 | indent_style = tab
--------------------------------------------------------------------------------
/src/utils/common.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export const windowIsUndefined = !(
4 | typeof window !== 'undefined' &&
5 | window.document &&
6 | window.document.createElement
7 | );
8 |
9 | export const useIsomorphicLayoutEffect = windowIsUndefined
10 | ? React.useEffect
11 | : React.useLayoutEffect;
12 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | build/
2 | *.cfg
3 | nohup.out
4 | *.iml
5 | .idea/
6 | .ipr
7 | .iws
8 | *~
9 | ~*
10 | *.diff
11 | *.log
12 | *.patch
13 | *.bak
14 | .DS_Store
15 | Thumbs.db
16 | .project
17 | .*proj
18 | .svn/
19 | *.swp
20 | out/
21 | .build
22 | node_modules
23 | .cache
24 | examples
25 | tests
26 | src
27 | /index.js
28 | .*
29 | assets/**/*.less
--------------------------------------------------------------------------------
/docs/examples/simple.tsx:
--------------------------------------------------------------------------------
1 | import Tween from 'rc-tween-one';
2 | import React from 'react';
3 |
4 | export default () => {
5 | const bbb = (e: any) => {
6 | console.log(e); // eslint-disable-line no-console
7 | };
8 | return (
9 |
21 | 当前参数:{tweenData}
21 | 87 |a
28 |a
39 |a
50 |a
61 |a
,b
], 83 | }); 84 | 85 | setTimeout(() => { 86 | children = instance.find('.wrapper').instance().children[0].children; 87 | console.log('children length:', children.length); 88 | expect(children.length).toBe(2); 89 | 90 | instance.setProps({ 91 | children: [a
], 92 | }); 93 | setTimeout(() => { 94 | children = instance.find('.wrapper').instance().children[0].children; 95 | console.log('children length:', children.length); 96 | expect(children.length).toBe(1); 97 | done(); 98 | }, 500); 99 | }, 500); 100 | }, 50); 101 | }); 102 | }); 103 | -------------------------------------------------------------------------------- /docs/examples/pathMotion.tsx: -------------------------------------------------------------------------------- 1 | import Tween from 'rc-tween-one'; 2 | import React from 'react'; 3 | import PathPlugin from 'rc-tween-one/es/plugin/PathMotionPlugin'; 4 | 5 | Tween.plugins.push(PathPlugin); 6 | 7 | const array = [ 8 | { x: 50, y: 50 }, 9 | { x: 200, y: 250 }, 10 | { x: 350, y: 50 }, 11 | { x: 500, y: 250 }, 12 | { x: 650, y: 50 } /* 13 | { x: 800, y: 250 }, 14 | { x: 950, y: 50 }, */, 15 | ]; 16 | 17 | export default function Demo() { 18 | const p = `M50.952,85.619C31.729,84.841,23.557,73.62,24.095,42.952 19 | c0.381-21.714,6.667-33.714,30.286-34.476 20 | c36.572-1.18,59.81,77.714,102.667,76.381c30.108-0.937,34.268-32.381,34.095-41.714 21 | C190.762,22.571,180.493,6.786,159.524,6C113.81,4.286,98,87.524,50.952,85.619z`; 22 | 23 | const p2 = 'M0,0,L100, 0L100, 100L0, 100Z'; 24 | return ( 25 |
47 |
48 | ### exclusive = true
49 |
50 | ```jsx
51 | import TweenOneGroup from 'rc-tween-one/es/TweenOneGroup';
52 | import React from 'react';
53 | import { Button } from 'antd';
54 | import 'antd/dist/antd.css';
55 |
56 | const imgArray = [
57 | 'https://os.alipayobjects.com/rmsportal/IhCNTqPpLeTNnwr.jpg',
58 | 'https://os.alipayobjects.com/rmsportal/uaQVvDrCwryVlbb.jpg',
59 | ];
60 | export default () => {
61 | const [int, setInt] = React.useState(0);
62 | return (
63 |