Card flip: compute width and generate background programmatically