[TIMOB-10304] Android: Cancel running animations on a view
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 3.0.0 |
Fix Version/s | n/a |
Components | Android |
Labels | core, insight |
Reporter | Martin Guillon |
Assignee | Unknown |
Created | 2012-07-31T02:14:15.000+0000 |
Updated | 2018-02-28T20:03:49.000+0000 |
Description
i needed to have a way to cancel running animations on a view.
So i added cancelAllAnimations
test case:
var win = Ti.UI.createWindow({ fullscreen: true, backgroundColor: 'white'});
var view = Ti.UI.createView({
backgroundColor:'red',
height:100,
width:100,
top:0,
left:0
});
win.add(view);
var button = Titanium.UI.createButton({
title:'Animate',
width:200,
height:40,
bottom:20,
left: 10
});
button.addEventListener('click', function()
{
view.updateLayout({left:0});
view.left = 0;
view.animate({left:(win.rect.width - view.rect.width), duration:2000}, function(){alert('animation completed!');});
});
win.add(button);
button = Titanium.UI.createButton({
title:'Cancel Animations',
width:200,
height:40,
bottom:20,
right:10
});
button.addEventListener('click', function()
{
view.cancelAllAnimations();
});
win.add(button);
win.open();
No comments