@Override
	public void layout() {
		float regionWidth, regionHeight;
		if (animation != null) {
			regionWidth = animation.getKeyFrame(0).getRegionWidth();
			regionHeight = animation.getKeyFrame(0).getRegionHeight();
		} else
			return;

		float width = getWidth();
		float height = getHeight();

		Vector2 size = scaling.apply(regionWidth, regionHeight, width, height);
		imageWidth = size.x;
		imageHeight = size.y;

		if ((align & Align.left) != 0)
			imageX = 0;
		else if ((align & Align.right) != 0)
			imageX = width-imageWidth;
		else
			imageX = (width/2)-(imageWidth/2);

		if ((align & Align.top) != 0)
			imageY = height-imageHeight;
		else if ((align & Align.bottom) != 0)
			imageY = 0;
		else
			imageY = (height/2)-(imageHeight/2);
	}