Smoother JS transition effect