Details

    • Type: New Feature
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      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

        Attachments

          Activity

            People

            • Assignee:
              emerriman Eric Merriman
              Reporter:
              michael Michael Gangolf
            • Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration