diff --git a/CHANGELOG.md b/CHANGELOG.md index 7294944..2ed2cde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## changelog +## 0.8.0 + +动画部分重构,可支持多动画同时配置。 + +画布拖动最小值变更为0。 + ## 0.7.7 diff --git a/packages/dooringx-example/src/plugin/formComponents/animateControl.tsx b/packages/dooringx-example/src/plugin/formComponents/animateControl.tsx index 72cab69..ea58196 100644 --- a/packages/dooringx-example/src/plugin/formComponents/animateControl.tsx +++ b/packages/dooringx-example/src/plugin/formComponents/animateControl.tsx @@ -1,5 +1,5 @@ import React, { useMemo, useState } from 'react'; -import { UserConfig, deepCopy } from 'dooringx-lib'; +import { UserConfig, deepCopy, createUid } from 'dooringx-lib'; import { Col, Row, Select, InputNumber, Button } from 'antd'; import { FormMap, FormBaseType } from '../formTypes'; import { CreateOptionsRes } from 'dooringx-lib/dist/core/components/formTypes'; @@ -114,13 +114,9 @@ const animateCategory: Record = { animate__slideOutRight: 'slideOutRight', }; -const duration = ['0s', '1s', '2s', '3s', '4s', '5s', '6s', '7s', '8s', '9s', '10s']; - -const delay = ['0s', '1s', '2s', '3s', '4s', '5s', '6s', '7s', '8s', '9s', '10s']; - const repeat = ['1', '2', '3', '4', '5', 'infinite']; -const timeFunction = { +const timeFunction: Record = { 平滑: 'linear', 缓入: 'ease in', }; @@ -132,11 +128,27 @@ function AnimateControl(props: AnimateControlProps) { <> {animate.map((v, i) => { return ( -
+
- 动画: - - { + const cloneData: IStoreData = deepCopy(store.getData()); + cloneData.block.forEach((w) => { + if (w.id === props.current.id) { + w.animate.forEach((f) => { + if (f.uid === v.uid) { + f.animationName = d; + } + }); + } + }); + store.setData(cloneData); + }} + > {Object.keys(animateCategory).map((v, i) => { return ( @@ -146,35 +158,75 @@ function AnimateControl(props: AnimateControlProps) { })} - 持续时间: - - + + 持续时间: + + + `${value}s`} + min={0} + onChange={(d) => { + const cloneData: IStoreData = deepCopy(store.getData()); + cloneData.block.forEach((w) => { + if (w.id === props.current.id) { + w.animate.forEach((f) => { + if (f.uid === v.uid) { + f.animationDuration = d; + } + }); + } + }); + store.setData(cloneData); + }} + /> - 延迟: - - + 延迟时间: + + `${value}s`} + min={0} + onChange={(d) => { + const cloneData: IStoreData = deepCopy(store.getData()); + cloneData.block.forEach((w) => { + if (w.id === props.current.id) { + w.animate.forEach((f) => { + if (f.uid === v.uid) { + f.animationDelay = d; + } + }); + } + }); + store.setData(cloneData); + }} + /> - 重复次数: - - { + const cloneData: IStoreData = deepCopy(store.getData()); + cloneData.block.forEach((w) => { + if (w.id === props.current.id) { + w.animate.forEach((f) => { + if (f.uid === v.uid) { + f.animationIterationCount = d; + } + }); + } + }); + store.setData(cloneData); + }} + > {repeat.map((v, i) => { return ( @@ -185,20 +237,36 @@ function AnimateControl(props: AnimateControlProps) { - - 延迟: - - { + const cloneData: IStoreData = deepCopy(store.getData()); + cloneData.block.forEach((w) => { + if (w.id === props.current.id) { + w.animate.forEach((f) => { + if (f.uid === v.uid) { + f.animationTimingFunction = d; + } + }); + } + }); + store.setData(cloneData); + }} + > + {Object.keys(timeFunction).map((v, i) => { return ( - + {v} ); })} - + + )}