[TIMOB-9739] Android: Animation stops working on Android after switching off/on "Reverse" function.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 2.1.0, Release 3.1.0 |
Fix Version/s | n/a |
Components | Android |
Labels | core, insight, qe-and060112 |
Reporter | Tamila Smolich |
Assignee | Unknown |
Created | 2012-06-23T12:15:53.000+0000 |
Updated | 2018-02-28T20:03:51.000+0000 |
Description
Description:
Animation stops working on Android after switching off/on "Reverse" function.
Steps to reproduce:
1. Run the following code on Android:
var win = Ti.UI.createWindow();
win.backgroundColor = "white";
var transform = Ti.UI.create2DMatrix().rotate(90);
var v = Ti.UI.createView({
right: "10dp",
width: "100dp",
height: "100dp",
top: "10dp",
backgroundColor: "#444"
});
win.add(v);
win.add(Ti.UI.createLabel({
text: "Reverse?:",
left: "10dp", width: "90dp",
color: "black",
height: "40dp", top: "10dp"
}));
win.add(Ti.UI.createLabel({
text: "Repeat:",
left: "10dp", width: "90dp",
color: "black",
height: "40dp", top: "55dp"
}));
var reverse = Ti.UI.createSwitch({
value: true,
left: "95dp", top: "10dp"
});
win.add(reverse);
var repeat = Ti.UI.createTextField({
value: "1",
keyboardType: Ti.UI.KEYBOARD_NUMBER_PAD,
left: "95dp", top: "55dp",
width: "80dp", height: "40dp",
color: "black",
borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED
});
win.add(repeat);
var btnAnimate = Ti.UI.createButton({
title: "Animate",
top: "100dp", left: "10dp",
width: "90dp", height: "40dp"
});
win.add(btnAnimate);
btnAnimate.addEventListener("click", function() {
var repeatCount = parseInt(repeat.value, 10);
if (isNaN(repeatCount) || repeatCount < 1) {
alert("Be sensible! Positive repeat count please!");
return;
}
v.animate({
transform: transform,
duration: 500,
autoreverse: reverse.value,
repeat: repeatCount
});
});
win.open();
2. Press "Animate" button
3. Switch "Reverse" off and press "Animate"
4. Switch "Reverse" on and press "Animate"
Actual result:
Animation does not work
Expected result:
Animation should work
The problem reproduces with release 3.0.2 and master release 3.1.0 tested on Titanium Studio, build: 3.0.2.201302191606 Titanium SDK version: 3.1.0 Titanium SDK version: 3.0.2 Device: Samsung galaxy s duos Android version: 4.0.4 Android Emulator: Android SDK version: 2.2 iOS iPhone Simulator: iOS SDK version: 6.0 it works similarly in ios emulator.
IMO this acts as expected. When you turn it off and click animate, it rotates to 90° and doesn't reverse. Therefore the next time you click animate it has nothing to do (it's already at 90°).