我正在寻找一些数学天才来帮助我解决这个问题:
我有一个非常简单的关键帧 js 动画:
var i = 0;
var o = 0; // opacity
var y_frames = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H"];
function draw_y() {
requestAnimationFrame( draw_y );
// drawing
if ( i < y_frames.length ) {
$y .text( y_frames[i] )
.css( { opacity: o } );
i++;
o += 0.03;
} else {
// code to be executed when animation finishes
}
};
draw_y();
除了步进关键帧之外,我还添加了一些不透明度,直到它达到值 1。这非常有效且非常平滑。到目前为止,一切都很好。我想添加一些easeOutSine 来增加不透明度值。我知道通过使用此功能可以做到这一点:
function easeOutSine(t, b, c, d) {
return c * Math.sin(t/d * (Math.PI/2)) + b;
}
但我需要一些帮助如何将两者结合起来。我怎样才能做到这一点?有人在我之前做过这个吗?非常感谢!
加拉瓦尼