Skip to content

Commit 1d869b2

Browse files
committed
[#164] Fixes AnimationProperty
1 parent 2f52235 commit 1d869b2

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

src/components/canvas/handlers/AnimationHandler.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class AnimationHandler {
2828
if (findObject.animation.type === 'none') {
2929
return;
3030
}
31-
const instance = this.getAnimation(findObject, hasControls);
31+
const instance = this.getAnime(findObject, hasControls);
3232
if (instance) {
3333
findObject.set('anime', instance);
3434
findObject.set({
@@ -184,9 +184,9 @@ class AnimationHandler {
184184
* @param {boolean} [hasControls]
185185
* @returns
186186
*/
187-
getAnimation = (obj: FabricObject, hasControls?: boolean) => {
188-
const { delay = 100, duration = 100, autoplay = true, loop = true, type, ...other } = obj.animation;
189-
const option = {
187+
getAnime = (obj: FabricObject, hasControls?: boolean) => {
188+
const { delay = 0, duration = 100, autoplay = true, loop = true, type, ...other } = obj.animation;
189+
const option: anime.AnimeParams = {
190190
targets: obj,
191191
delay,
192192
loop,
@@ -280,12 +280,15 @@ class AnimationHandler {
280280
easing: 'easeInQuad',
281281
});
282282
} else if (type === 'rotation') {
283+
const { angle = 360 } = other;
284+
obj.set('rotation', obj.angle);
283285
obj.set('originAngle', obj.angle);
284286
obj.set('originLeft', obj.left);
285287
obj.set('originTop', obj.top);
286288
Object.assign(option, {
287-
rotation: other.angle,
288-
easing: 'easeInQuad',
289+
rotation: angle,
290+
easing: 'linear',
291+
direction: 'normal',
289292
});
290293
} else if (type === 'flash') {
291294
const { fill = obj.fill, stroke = obj.stroke } = other;

src/components/imagemap/ImageMapEditor.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ const defaultOption = {
6565
type: 'none',
6666
loop: true,
6767
autoplay: true,
68-
delay: 100,
6968
duration: 1000,
7069
},
7170
userProperty: {},

src/components/imagemap/properties/AnimationProperty.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ export default {
6767
rules: [
6868
{
6969
type: 'number',
70-
min: 100,
70+
min: 0,
7171
max: 5000,
7272
},
7373
],
74-
initialValue: data.animation.delay,
75-
})(<Slider min={100} max={5000} step={100} />)}
74+
initialValue: data.animation.delay || 0,
75+
})(<Slider min={0} max={5000} step={100} />)}
7676
</Form.Item>
7777
</Col>
7878
<Col span={12}>
@@ -234,7 +234,7 @@ export default {
234234
max: 360,
235235
},
236236
],
237-
initialValue: data.animation.angle || data.angle,
237+
initialValue: data.animation.angle || 360,
238238
})(<Slider min={0} max={360} />)}
239239
</Form.Item>
240240
);

0 commit comments

Comments
 (0)