var win = Ti.UI.createWindow();
var mapview = Titanium.Map.createView({
mapType : Titanium.Map.STANDARD_TYPE,
animate : true,
regionFit : true,
userLocation : false,
width : '100%',
height : '100%',
top : 0,
});
mapview.setLocation({
latitude : 37.337681,
longitude : -122.038193,
animate : true,
latitudeDelta : 0.04,
longitudeDelta : 0.04
});
mapview.addEventListener('complete', function(e) {
Ti.API.info('complete');
displayAnimation();
});
mapview.addEventListener('regionChanged', function(e) {
Ti.API.info('regionChanged');
Ti.API.info(e);
});
function displayAnimation(args) {
var view = Titanium.UI.createView({
bottom : 0,
backgroundColor : 'red',
height : 100
});
win.add(view);
var label = Titanium.UI.createLabel({
text : 'x',
right : 0,
top : 0,
color : 'blue'
});
view.add(label);
var animation = Titanium.UI.createAnimation();
animation.backgroundColor = 'black';
animation.duration = 5000;
var animationHandler = function() {
animation.removeEventListener('complete', animationHandler);
animation.backgroundColor = 'orange';
view.animate(animation);
mapview.setHeight('80%');
};
animation.addEventListener('complete', animationHandler);
view.animate(animation);
label.addEventListener('click', function(e) {
mapview.setHeight('100%');
mapview.setWidth('100%');
view.hide();
mapview.setLocation({
latitude : 37.333681,
longitude : -122.033193,
animate : true,
latitudeDelta : 0.04,
longitudeDelta : 0.04
});
});
}
// Add to parent
win.add(mapview);
win.open();