I had a different view of the minimum point value that is visually recognizable. The smallest unit for pt I noticed that the change was 0.2pt .
However, I noticed that when applying the change in increments of 0.2 points over a period of 1 millisecond per increment in the while loop, it still looked a bit βlaggyβ. May not work if not working in jsfiddle.
The fact is that if you want to smoothly change the font size by 10 points, you must apply the change in steps of 0.2pt or 0.25pt or 0.5pt (which you will ever find the most smooth) at a time and you must use interval 1 to Remain smooth, but you should not use a different interval, because otherwise the incremental steps should be small to notice, and the whole animation becomes discontinuous again.
I think that trying to make this 10pt change in 2 seconds will always look messy, no matter what structure you use, due to the lack of a visual change in font size in the lower decimal places.
This worked for me pretty well:
(In this example, I do not take into account the decreasing font size animation, but this can be added from the course)
function smoothAnimation($selector, startPoints, points){ var increments = 0.2; var currentPoints = startPoints; var endPoints = currentPoints + points; while(currentPoints < endPoints){ currentPoints += increments; $selector.animate({"font-size": currentPoints.toString() + "pt"}, 1, "swing"); } } $('#msg').click(function() { $msg = $('#msg'); $msg.animate({"font-size": "80pt"}, 400, "swing"); smoothAnimation($msg, 80, 10); $msg.animate({"font-size": "40pt"}, 400, "swing"); });
DEMO - smooth (ish) font size animation
To make it smoother, increase the increments value to 0.25 or even 0.5 . You have a nice smooth step, you can set the dots to any other value, and the animation will remain smooth if you do not press the 2-second animation interval.