Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5460] Android: Support Animation of backgroundColor

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2011-10-31T16:21:19.000+0000
Affected Version/sRelease 1.8.0
Fix Version/sSprint 2011-40, Release 1.8.0
ComponentsAndroid
Labelsmodule_animation, qe-testadded, stage
ReporterDon Thorp
AssigneeDon Thorp
Created2011-10-06T13:46:44.000+0000
Updated2012-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();

Comments

  1. Natalie Huynh 2012-01-25

    Tested with 1.8.1.v20120125154634 on Droid 3 2.3.4

JSON Source