[TIMOB-13134] Android: Animation - Parent window becomes transparent when animated object moves off screen.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2013-05-24T08:36:58.000+0000 |
Affected Version/s | Release 2.1.2, Release 3.0.2, Release 3.1.0 |
Fix Version/s | 2013 Sprint 11 |
Components | Android |
Labels | android, animation, bug, exalture |
Reporter | Francois Brosseau |
Assignee | Shameer Jan |
Created | 2012-09-28T17:51:33.000+0000 |
Updated | 2017-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
File | Date | Size |
---|---|---|
androidanim1.jpg | 2012-09-28T23:11:42.000+0000 | 71875 |
androidanim2.jpg | 2012-09-28T23:11:42.000+0000 | 71976 |
uploaded pictures of expected behavior.
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.
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
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
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