Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17673] Animation duration is ignored if property is same as currently applied

GitHub Issuen/a
TypeBug
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsTiAPI
Labelsn/a
ReporterMatthew Congrove
AssigneeUnknown
Created2014-09-10T18:49:35.000+0000
Updated2018-02-28T20:03:24.000+0000

Description

If an animation is trying to change a property to what is already applied (e.g. view has width of 1px, animation is setting to 1px), then the completion event is immediately fired, ignoring the animation duration. To see this in action, run the code below. You'll see that for the first animation you get the console output one time; 2 seconds later, a flurry of console items appear. This is problematic, as if you assume the complete event will not fire until after the duration has elapsed, this could lead to circumstances which cripple a running application.
<Alloy>
	<Window id="win">
		<View id="container"></View>
	</Window>
</Alloy>
"#win": {
	width: Ti.UI.FILL,
	height: Ti.UI.FILL,
	backgroundColor: "#000"
},
"#container": {
	width: Ti.UI.FILL,
	height: Ti.UI.FILL,
	backgroundColor: "#FFF"
}
function animateView() {
	Ti.API.error("Running animateView");
	
	var anim = Ti.UI.createAnimation({
		width: 1,
		duration: 2000
	});
	
	anim.addEventListener("complete", function() {
		gradient();
	});
	
	$.container.animate(anim);
}

$.win.addEventListener("open", animateView);

$.win.open();

Comments

No comments

JSON Source