Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-7192

view.animate() does not update the properties of the view that have been updated

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Low
    • Resolution: Invalid
    • Affects Version/s: Release 1.8.0.1
    • Fix Version/s: None
    • Component/s: TiAPI
    • Environment:

      Titanium SDK version: 1.8.0.1
      Host Operating System: OSX 10.7.2
      Titanium Studio version: 1.0.7.201112132151

      Description

      Problem

      After a Ti.UI.Animation is run on a view with the animate() function, the properties that were animated should be updated on the view. For example, the following code animates a view to a new top position, but the top property of the view does not reflect this afterwards.

      var win = Ti.UI.createWindow({
      	backgroundColor: '#fff',
      	fullscreen: false,
      	exitOnClose: true
      });
      var view = Ti.UI.createView({
      	backgroundColor: '#800',
      	height: 200,
      	width: 200,
      	top: 0,
      	left: 0
      });
      view.addEventListener('click', function(e) {
      	Ti.API.info(e.source.top);
      });
      win.addEventListener('open', function(e) {
      	view.animate({
      		top: 200,
      		duration: 500
      	});
      });
      win.add(view);
      win.open();
      

      After the view animates and you click on it, it still indicates that the top property is a value of 0 (zero).

      Expected Behavior

      The view's top property in the above example should be 200 after the animation.

      Workaround

      For now, if you want the properties to be updated, you need to do it manually in the animation's complete event. This is troublesome because of the fact that you don't get a reference to the animated view in the complete event, it needs to be either manually assigned to the Ti.UI.Animation, or into ta closure, as referenced in ticket TIMOB-7190

      Here is the above code modified with the workaround

      var win = Ti.UI.createWindow({
      	backgroundColor: '#fff',
      	fullscreen: false,
      	exitOnClose: true
      });
      var view = Ti.UI.createView({
      	backgroundColor: '#800',
      	height: 200,
      	width: 200,
      	top: 0,
      	left: 0
      });
      view.addEventListener('click', function(e) {
      	Ti.API.info(e.source.top);
      });
      win.addEventListener('open', function(e) {
      	var animation = Ti.UI.createAnimation({
      		top: 200,
      		duration: 500
      	});
      	animation.addEventListener('complete', function(e) {
      		view.top = e.source.top;
      	});
      	view.animate(animation);
      });
      win.add(view);
      win.open();
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ingo Ingo Muschenetz
                Reporter:
                tlukasavage Tony Lukasavage
              • Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-11735
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration