[TIMOB-26408] Android: Add stopAnimation() to View
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | android, animation |
Reporter | Michael Gangolf |
Assignee | Eric Merriman |
Created | 2018-09-22T15:07:40.000+0000 |
Updated | 2018-09-23T20:53:57.000+0000 |
Description
Android has no possibility to cancel/stop animations like moving an object from left to right before the duration is over. This PR adds a stopAnimation() method to Ti.UI.View
var win = Ti.UI.createWindow({
backgroundColor: 'white'
});
var lbl = Ti.UI.createLabel({
text: "-",
color: "#000",
width: Ti.UI.SIZE,
height: Ti.UI.SIZE
});
var view = Ti.UI.createView({
backgroundColor: 'red',
height: 100,
width: 100,
top: 0,
left: 0
});
var btn1 = Ti.UI.createButton({
title: 'Animate',
width: 100,
height: 40,
bottom: 20,
left: 10
});
btn1.addEventListener('click', function() {
view.left = 0;
view.animate(ani);
});
var btn2 = Ti.UI.createButton({
title: 'Cancel',
width: 100,
height: 40,
bottom: 20,
right: 10
});
btn2.addEventListener('click', function() {
view.stopAnimation();
view.left = 0;
});
var ani = Ti.UI.createAnimation({
left: 100,
duration: 3000
})
ani.addEventListener("start", function() {
console.log("start");
lbl.text = "start";
});
ani.addEventListener("complete", function() {
console.log("complete");
lbl.text = "complete";
})
ani.addEventListener("cancel", function() {
console.log("cancel");
lbl.text = "cancel";
})
win.add([view, btn1, btn2, lbl]);
win.open();
PR: https://github.com/appcelerator/titanium_mobile/pull/10130
Hello [~michael], This for the request and the PR. This is a valid feature request. Our engineers will look into it. Moving to engineering. Thanks.