Created
August 18, 2012 13:14
-
-
Save donayama/3386786 to your computer and use it in GitHub Desktop.
Toolbarをくるくる回転…させられなかった。
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 window = Ti.UI.createWindow(); | |
var mapView = Ti.Map.createView({ | |
bottom : 44 | |
}); | |
var flex = Ti.UI.createButton({ | |
systemButton : Ti.UI.iPhone.SystemButton.FLEXIBLE_SPACE | |
}); | |
var button1 = Ti.UI.createButton({ | |
title : 'Switch 1 to 2' | |
}); | |
var button2 = Ti.UI.createButton({ | |
title : 'Switch 2 to 3' | |
}); | |
var button3 = Ti.UI.createButton({ | |
title : 'Switch 3 to 1' | |
}); | |
var initTransform = Titanium.UI.create3DMatrix(); | |
initTransform = initTransform.rotate(90, 1.0, 0.0, 0.0); | |
var openTransform = Titanium.UI.create3DMatrix(); | |
openTransform = openTransform.rotate(00, 1.0, 0.0, 1.0); | |
var closeTransform = Titanium.UI.create3DMatrix(); | |
closeTransform = closeTransform.rotate(-90, 1.0, 0.0, 0.0); | |
var initAnimation = { | |
duration : 0, | |
curve : Ti.UI.ANIMATION_CURVE_EASE_IN_OUT, | |
bottom : 44, | |
transform : initTransform | |
}; | |
var openAnimation = { | |
delay : 100, | |
duration : 400, | |
curve : Ti.UI.ANIMATION_CURVE_EASE_IN_OUT, | |
bottom : 0, | |
transform : openTransform | |
}; | |
var closeAnimation = { | |
duration : 450, | |
curve : Ti.UI.ANIMATION_CURVE_EASE_IN_OUT, | |
bottom : 0, | |
transform : closeTransform | |
}; | |
var toolbar1 = Ti.UI.iOS.createToolbar({ | |
barColor : 'blue', | |
bottom : 0, | |
height : 44, | |
items : [flex, button1, flex], | |
anchorPoint : { | |
x : 1, | |
y : 1 | |
}, | |
zIndex : 1000 | |
}); | |
var toolbar2 = Ti.UI.iOS.createToolbar({ | |
barColor : 'green', | |
bottom : 44, | |
height : 44, | |
items : [flex, button2, flex], | |
transform : initTransform, | |
anchorPoint : { | |
x : 1, | |
y : 1 | |
}, | |
zIndex : 1000 | |
}); | |
var toolbar3 = Ti.UI.iOS.createToolbar({ | |
barColor : 'orange', | |
bottom : 44, | |
height : 44, | |
items : [flex, button3, flex], | |
transform : initTransform, | |
anchorPoint : { | |
x : 1, | |
y : 1 | |
}, | |
zIndex : 1000 | |
}); | |
button1.addEventListener('click', function(e) { | |
toolbar1.animate(closeAnimation); | |
toolbar2.animate(openAnimation); | |
toolbar3.animate(initAnimation); | |
}); | |
button2.addEventListener('click', function(e) { | |
toolbar2.animate(closeAnimation); | |
toolbar3.animate(openAnimation); | |
toolbar1.animate(initAnimation); | |
}); | |
button3.addEventListener('click', function(e) { | |
toolbar3.animate(closeAnimation); | |
toolbar1.animate(openAnimation); | |
toolbar2.animate(initAnimation); | |
}); | |
window.add(mapView); | |
window.add(toolbar1); | |
window.add(toolbar2); | |
window.add(toolbar3); | |
window.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment