feat:Do not change the rotattion value for Android
This commit is contained in:
parent
3a89571f42
commit
d56556fb4a
@ -386,12 +386,6 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
|||||||
|
|
||||||
@DoricMethod
|
@DoricMethod
|
||||||
public void setRotation(float rotation) {
|
public void setRotation(float rotation) {
|
||||||
while (rotation > 2) {
|
|
||||||
rotation = rotation - 2;
|
|
||||||
}
|
|
||||||
while (rotation < -2) {
|
|
||||||
rotation = rotation + 2;
|
|
||||||
}
|
|
||||||
getNodeView().setRotation(rotation * 180);
|
getNodeView().setRotation(rotation * 180);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class AnimatorDemo extends Panel {
|
|||||||
const view = box(2)
|
const view = box(2)
|
||||||
let idx = 0
|
let idx = 0
|
||||||
vlayout([
|
vlayout([
|
||||||
title("Animator Demo"),
|
title("Animator zDemo"),
|
||||||
vlayout(
|
vlayout(
|
||||||
[
|
[
|
||||||
hlayout([
|
hlayout([
|
||||||
@ -28,8 +28,11 @@ class AnimatorDemo extends Panel {
|
|||||||
animate(this)({
|
animate(this)({
|
||||||
animations: () => {
|
animations: () => {
|
||||||
view.width = view.height = 20
|
view.width = view.height = 20
|
||||||
|
view.x = view.y = 0
|
||||||
|
view.rotation = 0
|
||||||
|
view.bgColor = colors[2]
|
||||||
},
|
},
|
||||||
duration: 3000,
|
duration: 1500,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
modal(context).toast('Fininshed')
|
modal(context).toast('Fininshed')
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
@ -37,15 +40,37 @@ class AnimatorDemo extends Panel {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
]),
|
thisLabel('Move X').apply({
|
||||||
|
onClick: () => {
|
||||||
|
animate(this)({
|
||||||
|
animations: () => {
|
||||||
|
view.x = view.x || 0
|
||||||
|
view.x += 100
|
||||||
|
},
|
||||||
|
duration: 1000,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
thisLabel('Move Y').apply({
|
||||||
|
onClick: () => {
|
||||||
|
animate(this)({
|
||||||
|
animations: () => {
|
||||||
|
view.y = view.y || 0
|
||||||
|
view.y += 100
|
||||||
|
},
|
||||||
|
duration: 1000,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
]).apply({ space: 10 } as IHLayout),
|
||||||
hlayout([
|
hlayout([
|
||||||
thisLabel('Width').apply({
|
thisLabel('Width').apply({
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
animate(this)({
|
animate(this)({
|
||||||
animations: () => {
|
animations: () => {
|
||||||
view.width = 200
|
view.width += 100
|
||||||
},
|
},
|
||||||
duration: 3000,
|
duration: 1000,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@ -53,9 +78,9 @@ class AnimatorDemo extends Panel {
|
|||||||
onClick: () => {
|
onClick: () => {
|
||||||
animate(this)({
|
animate(this)({
|
||||||
animations: () => {
|
animations: () => {
|
||||||
view.height = 200
|
view.height += 100
|
||||||
},
|
},
|
||||||
duration: 3000,
|
duration: 1000,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@ -67,7 +92,7 @@ class AnimatorDemo extends Panel {
|
|||||||
animations: () => {
|
animations: () => {
|
||||||
view.bgColor = colors[(idx++) % colors.length]
|
view.bgColor = colors[(idx++) % colors.length]
|
||||||
},
|
},
|
||||||
duration: 3000,
|
duration: 1000,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@ -75,9 +100,13 @@ class AnimatorDemo extends Panel {
|
|||||||
onClick: () => {
|
onClick: () => {
|
||||||
animate(this)({
|
animate(this)({
|
||||||
animations: () => {
|
animations: () => {
|
||||||
view.rotation = view.rotation || 0 + 0.5
|
if (view.rotation) {
|
||||||
|
view.rotation += 0.5
|
||||||
|
} else {
|
||||||
|
view.rotation = 0.5
|
||||||
|
}
|
||||||
},
|
},
|
||||||
duration: 3000,
|
duration: 1000,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@ -85,9 +114,7 @@ class AnimatorDemo extends Panel {
|
|||||||
]
|
]
|
||||||
).apply({ space: 10 } as IVLayout),
|
).apply({ space: 10 } as IVLayout),
|
||||||
stack([
|
stack([
|
||||||
view.also(v => {
|
view
|
||||||
v.left = 20
|
|
||||||
})
|
|
||||||
]).apply({
|
]).apply({
|
||||||
layoutConfig: layoutConfig().atmost(),
|
layoutConfig: layoutConfig().atmost(),
|
||||||
bgColor: colors[1].alpha(0.3 * 255),
|
bgColor: colors[1].alpha(0.3 * 255),
|
||||||
|
Reference in New Issue
Block a user