feat:fix Android animation problem

This commit is contained in:
pengfei.zhou 2019-11-29 20:47:42 +08:00
parent 7e8708a73b
commit 6b4bc9cd0f
3 changed files with 24 additions and 1 deletions

View File

@ -281,6 +281,7 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
} else {
setScaleX(prop.asNumber().toFloat());
}
break;
case "scaleY":
if (isAnimating()) {
addAnimator(ObjectAnimator.ofFloat(
@ -291,6 +292,7 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
} else {
setScaleY(prop.asNumber().toFloat());
}
break;
case "pivotX":
if (isAnimating()) {
addAnimator(ObjectAnimator.ofFloat(

View File

@ -17,6 +17,7 @@ function thisLabel(str: string) {
class AnimatorDemo extends Panel {
build(rootView: Group): void {
const view = box(2)
const view2 = box(3)
let idx = 0
vlayout([
title("Animator zDemo"),
@ -54,6 +55,7 @@ class AnimatorDemo extends Panel {
animations: () => {
view.x = view.x || 0
view.x += 100
view2.x += 50
},
duration: 1000,
})
@ -65,6 +67,7 @@ class AnimatorDemo extends Panel {
animations: () => {
view.y = view.y || 0
view.y += 100
view2.y += 50
},
duration: 1000,
})
@ -165,7 +168,7 @@ class AnimatorDemo extends Panel {
]
).apply({ space: 10 } as IVLayout),
stack([
view
view,
]).apply({
layoutConfig: layoutConfig().atmost(),
bgColor: colors[1].alpha(0.3 * 255),

View File

@ -20,9 +20,27 @@ export enum RepeatMode {
}
export class Animation {
translationX?: number
translationY?: number
scaleX?: number
scaleY?: number
pivotX?: number
pivotY?: number
rotation?: number
duration = 100
startDelay = 0
repeatCount = 1
repeatMode = RepeatMode.RESTART
}