Animating a view...
I'm trying to animate a view to move to the right 100px and down 100px. Unfortuantly, nothing happens when I fire the event I'm listening for. Any help would be appreciated!
// Add a default color to show when nothing is open
Titanium.UI.setBackgroundColor('#000');
// Create a view with a pleasing background color
var window = Titanium.UI.createWindow({
backgroundColor:'#0F0F1F',
exitOnClose: true
});
// Create a view to animate
var view = Titanium.UI.createView({
top: 0,
left: 0,
borderRadius:10,
backgroundColor:'red',
width:50,
height:50
});
window.add(view);// Add the view to the window
// Create the event listener that will call my animation
view.addEventListener('click', function()
{
// Start the animation when the event is called
view.animate(
{
right:100,
top:100,
duration:500});
});
// Create a text label to provide instructions
var label = Titanium.UI.createLabel(
{
text:'Click to animate',
bottom:75,
width:'auto',
height:'auto',
textAlign:'center'
});
window.add(label);// Add the label to the window
window.open({fullscreen:true});// Open the window
1 Answer
-
Accepted Answer
down, does not exist : try to modify the top value
view.animate(
{
right:100,
top:100,
duration:500});
});