Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13134] Android: Animation - Parent window becomes transparent when animated object moves off screen.

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-05-24T08:36:58.000+0000
Affected Version/sRelease 2.1.2, Release 3.0.2, Release 3.1.0
Fix Version/s2013 Sprint 11
ComponentsAndroid
Labelsandroid, animation, bug, exalture
ReporterFrancois Brosseau
AssigneeShameer Jan
Created2012-09-28T17:51:33.000+0000
Updated2017-03-27T18:34:36.000+0000

Description

this code is from Lab340 of the TCMD course lab
var an = {}; // namespace an=animation

(function() {
	an.ui = {};
	
	an.ui.createApplicationWindow = function(){
		// we've laid out most of the UI for you; here's the window
		var win = Ti.UI.createWindow({
			backgroundColor:'#fff'
		});
		// and a heading
		win.add(Ti.UI.createLabel({
			text:'Click the boxes for fun!',
			color:'#000',
			font:{
				fontSize:20,
				fontWeight:'bold'
			},
			height:'auto',
			width:'auto',
			top:10
		}));
		var box = function(color, whatsItDo) {
			// helper function for making colored boxes
			var bx = Ti.UI.createView({
				height:50,
				width:100,
				backgroundColor:color
			});
			// box contains a centered label
			bx.add(Ti.UI.createLabel({
				height:'auto',
				width:'auto',
				text: whatsItDo,
				color:'#fff',
				font:{
					fontWeight:'bold'
				}
			}));
			return bx;
		};
		
		// now we'll add four colored boxes and set a helper variable you'll need later
		var box1 = box('red', 'fade out/in'),
			box2 = box('green', 'fly out/in'),
			box3 = box('yellow', 'transition'),
			box4 = box('blue', 'transition'),
			selectedIndex = 0;
		box1.top = 50;
		box2.top = 120;
		box3.children[0].color="#000";
		win.add(box1);
		win.add(box2);
		
		// this container holds the two boxes you'll transition between
		var container = Ti.UI.createView({
			width:'auto',
			height: 70,
			top: 180
		});
		container.add(box3);
		container.add(box4);
		win.add(container);
		
		// **************************************************
		// Here's where you come in:
		//
		// add an event listener to box1 so that when clicked, it fades out of view in 2 seconds, then fades back into view
		box1.addEventListener('click', function(){
			box1.animate({
				opacity:0,
				duration:2000
			}, function(){
				box1.animate({
					opacity:1,
					duration:2000
				});
			});
		});

		// add an event listener to box2 so that when clicked, it slides off the bottom edge of the screen in 2 seconds, then returns
		box2.addEventListener('click', function(){
			box2.animate({
				top:800,
				duration:2000
			}, function(){
				box2.animate({
					top:120,
					duration:2000
				});
			});
		});
		
		// add an event listener to container that tracks odd/even numbered clicks. 
		// with odd-numbered clicks, box4 transitions into view using the flip-from-right style
		// for even-numbered clicks, box3 transitions into view using the flip-from-left style
		// this effect will work on only iOS
			// **************************************************
		// all done, return the window
		return win;
	};
})();
an.mainWin = an.ui.createApplicationWindow();
an.mainWin.open();
when running inside the emulator and on a device, box2 animates correctly but as soon as it moves off the screen, the parent window disappears and makes way to the default appcelerator 'splash' screen that is usually bundled with these Labs.

Attachments

FileDateSize
androidanim1.jpg2012-09-28T23:11:42.000+000071875
androidanim2.jpg2012-09-28T23:11:42.000+000071976

Comments

  1. Francois Brosseau 2012-09-28

    uploaded pictures of expected behavior.
  2. Daniel Sefton 2013-03-20

    Tested and confirmed on Samsung Galaxy S2 OS 2.3.6, Ti SDK 3.0.2. Also, the first box animation seems to glitch a bit.
  3. jithinpv 2013-04-22

    Issue reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 Titanium SDK version: 3.0.2 Android Emulator: Android SDK version: 2.2
  4. Shameer Jan 2013-05-24

    The problem cannot reproduced with release 3.2.0 Tested with Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.2.0 Android Emulator: Android SDK version: 2.2
  5. Lee Morris 2017-03-27

    Closing ticket as I am unable to reproduce this issue with the following environment; Pixel (7.1) MacOS 10.11.6 (15G31) Studio 4.8.1.201612050850 Ti SDK 6.0.3 GA Appc NPM 4.2.8 Appc CLI 6.1.0 Ti CLI 5.0.11 Alloy 1.9.5 Arrow 1.10.1 Xcode 8.2 (8C38) Node v4.6.0 Java 1.7.0_80

JSON Source