fadeIn()

Fade in the object.

Syntax fadeIn([ duration [, easing [, callback ]]])
fadeIn([ duration | easing | callback [, callback ]])

Return Type displayObject

Description

Fade in the object. This is a shorthand for the animate() method. It only passes an object with opacity: 1 to the animate() method. See the animate() method for more details about the arguments.

Return Value

displayObject. Returns the display object itself.

Examples

Example 1

We create a new core instance and a rectangle that we add to the canvas. Then we bind an event handler to the canvas, which will clear the animation queue and start the fade animation, when the canvas is clicked. With the callback we specify that the fill color should be red when the animation is complete.

View Example
Code
var canvas = oCanvas.create({
	canvas: "#canvas",
	background: "#ccc",
	fps: 60
});

var rectangle = canvas.display.rectangle({
	x: 77,
	y: 150,
	width: 200,
	height: 100,
	fill: "#000",
	opacity: 0
});

canvas.addChild(rectangle);

canvas.bind("click tap", function () {

	rectangle.stop();
	rectangle.fadeIn("long", "ease-in-out-cubic", function () {
		this.fill = "#f00";
		canvas.redraw();
	});
});
Output