Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7190] Add 'view' property to Ti.UI.Animation

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 1.8.0.1
Fix Version/sn/a
ComponentsTiAPI
Labelsanimation, dr-list, improvement, pathmenu
ReporterTony Lukasavage
AssigneeIngo Muschenetz
Created2012-01-15T14:09:24.000+0000
Updated2015-04-13T20:09:52.000+0000

Description

Currently there is no way to know what view a Ti.UI.Animation is operating on. So for example, if I want to perform another operation on the target view after the Animation completes, I need to add that reference directly to the Animation manually.
var view = Ti.UI.createView(/* set view properties */);
var animation = Ti.UI.createAnimation({
    duration: 1000,
    top: 100,
    // I need to add this manually so that I know what view was animated in the upcoming 'complete' event
    view: view
});
animation.addEventListener('complete', function(e) {
    // There is no native property in Ti.UI.Aniamtion, nor the returned event object, that 
    // gives me access to the view being animated. Until this property is added, I'll have to 
    // use the property I added manually.
    e.source.view.backgroundColor = '#f00';
});
view.animate(animation);
It would be much easier if when view.animate() was called, the Animate object automatically had the appropriate view added to it as a property.

Comments

  1. Chris Barber 2012-01-15

    I don't think this is necessary since the complete event is passed a "source" which would be the view that was animated. Here's the API docs: http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.Animation.complete-event.html
  2. Tony Lukasavage 2012-01-15

    In my testing on iOS and Android, e.source returns the Ti.UI.Animation, not the view that is animating.
  3. Chris Barber 2012-01-15

    Sorry, you're right. That is how it will be in mobile web too. Perhaps this ticket should be to add a "target" to the Ti.UI.Animation start/complete events that would be the UI element being animated.

JSON Source