Optimize animation and thread defination.