[TIMOB-5460] Android: Support Animation of backgroundColor
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-10-31T16:21:19.000+0000 |
Affected Version/s | Release 1.8.0 |
Fix Version/s | Sprint 2011-40, Release 1.8.0 |
Components | Android |
Labels | module_animation, qe-testadded, stage |
Reporter | Don Thorp |
Assignee | Don Thorp |
Created | 2011-10-06T13:46:44.000+0000 |
Updated | 2012-01-25T16:23:46.000+0000 |
Description
add ability to animate backgroundColor. Note the view MUST have a backgroundColor and no backgroundImages for this to work.
Ti.UI.setBackgroundColor('black');
var win = Ti.UI.createWindow({
backgroundColor: 'black'
});
var fromColor = '#2d6e32';
var toColor = '#35883b';
var v = Ti.UI.createView({
width: '100dp',
height: '100dp',
backgroundColor: fromColor
});
var b = Ti.UI.createButton({
title: 'Animate',
bottom: '10dp',
left: '10dp'
});
b.addEventListener('click', function() {
v.animate({
backgroundColor: toColor,
duration: 500
});
});
var b1 = Ti.UI.createButton({
title: 'Reset',
bottom: '10dp',
right: '10dp'
});
b1.addEventListener('click', function() {
v.backgroundColor = toColor;
v.backgroundColor = fromColor;
});
var v1 = Ti.UI.createView({
width : '50dp',
height: '50dp',
backgroundColor: 'white'
});
win.add(v);
win.add(b);
win.add(b1);
win.add(v1);
win.open();
Tested with 1.8.1.v20120125154634 on Droid 3 2.3.4