Currently, I am utilizing the jquery animate function for animating text while also aiming to rotate the text if a specific degree is passed. In order to achieve this, I have implemented the following code snippet:
var leftCss = "-"+$('#mydiv').width();
var leftAnt = $('#mydiv').parent().width();
$('#mydiv').each(function () {this.xpos = leftCss; })
.animate({ xpos: leftAnt}, {
duration:10000,
step: function (now) {
var scaleVal =parseInt( now);
$(this).css('transform','rotate(0deg) translateX('+scaleVal+'px) translateY('+$('#mydiv').height()+'px)');
},
},'linear');
https://jsfiddle.net/nufafjjs/1/
Although it begins fast and slows down towards the end, I desire a consistent speed throughout the animation. Any idea what could be causing this inconsistency? Furthermore, when the rotation exceeds 90 degrees, the text disappears from view.
Thank you!