问题
$(element).delay(2000).animate(
{
scale: 1,
},
{
duration: 1000,
step: function(now) {
scaleVal = now;
$(element).attr("transform", "translate(" + centerX + " " + centerY + ") scale(" + scaleVal + ") translate(" + (-centerX) + " " + (-centerY) + ")");
}
}
);
Now the scale value starts from 0 and ends up in 1 but instead of this I want to start from 0.5 and ends up in 1.
How can I initialize the scale value in animate function?
回答1:
you need to use css
function
$(ele).css('scale', 0.5).animate({scale:1});
来源:https://stackoverflow.com/questions/17037687/jquery-animate-function-initialize-the-value