Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10304] Android: Cancel running animations on a view

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.0.0
Fix Version/sn/a
ComponentsAndroid
Labelscore, insight
ReporterMartin Guillon
AssigneeUnknown
Created2012-07-31T02:14:15.000+0000
Updated2018-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();

Comments

No comments

JSON Source