Created
September 8, 2010 00:23
-
-
Save anonymous/569379 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Titanium.UI.currentWindow; | |
var viewTaskbar = Ti.UI.createView({ | |
backgroundColor:'#D4D4D4', | |
borderRadius: 4, | |
height:22, | |
right:0, | |
top:0, | |
width:200, | |
zIndex: 30 | |
}); | |
win.add(viewTaskbar); | |
var viewInnerTaskbar = Ti.UI.createView({ | |
backgroundColor:'#D4D4D4', | |
borderRadius: 4, | |
height:20, | |
right:1, | |
top:2, | |
width:20, | |
zIndex: 30 | |
}); | |
viewTaskbar.add(viewInnerTaskbar); | |
var transformRotateAntiClockwise = Ti.UI.create2DMatrix(); | |
transformRotateAntiClockwise = transformRotateAntiClockwise.rotate(-180); | |
var transformRotateClockwise = Ti.UI.create2DMatrix(); | |
transformRotateClockwise = transformRotateClockwise.rotate(180); | |
var animateRotateAntiClockwise = Ti.UI.createAnimation(); | |
animateRotateAntiClockwise.transform = transformRotateAntiClockwise; | |
animateRotateAntiClockwise.delay = 10; | |
animateRotateAntiClockwise.duration = 3000; | |
var animateRotateClockwise = Ti.UI.createAnimation(); | |
animateRotateClockwise.transform = transformRotateClockwise; | |
animateRotateClockwise.delay = 10; | |
animateRotateClockwise.duration = 3000; | |
var imageViewTaskbar = Ti.UI.createImageView({ | |
anchorPoint:{x:0.5, y:0.5}, | |
image: '/taskbar-menu-icon2.png', | |
height: 'auto', | |
top:0, | |
right:0, | |
width: 'auto', | |
zIndex: 31 | |
}); | |
viewInnerTaskbar.add(imageViewTaskbar); | |
var taskbarEnabled = true; | |
viewInnerTaskbar.addEventListener('click', function(){ | |
if(taskbarEnabled === true){ | |
Ti.API.info('Firing anticlockwise animation'); | |
viewTaskbar.animate(animateRotateAntiClockwise); | |
taskbarEnabled = false; | |
} else { | |
Ti.API.info('Firing clockwise animation'); | |
viewTaskbar.animate(animateRotateClockwise); | |
taskbarEnabled = true; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment