Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var i = index - 1, frame = timeToFrames(time), length = 40;
- var row = Math.floor(i / 16), col = i % 16;
- var transition = 10 + row * 4 + 2 * i;
- var slow = 300, stop = 350;
- var startX = 71 + 40 * col, endX = 800;
- var startY = 240 + 40 * row;
- if (frame < slow) {
- endY = 400 + 40 * i - 8 * frame;
- } else if (frame > stop) {
- endY = 400 + 40 * i - 4 * slow - 4 * stop;
- } else {
- var m = 400 + 40 * i - 8 * slow, n = 400 + 40 * i - 4 * slow - 4 * stop, o = -8 * (stop - slow), p = 0;
- var a = 2 * m - 2 * n + o + p, b = -3 * m + 3 * n - 2 * o - p, c = o, d = m;
- var x = (frame - slow) / (stop - slow);
- endY = Math.round(a * x * x * x + b * x * x + c * x + d);
- }
- if (frame < transition) {
- [startX, startY];
- } else if (frame > transition + length) {
- [endX, endY];
- } else {
- var t = (frame - transition) / length;
- var perc = -2 * t * t * t + 3 * t * t;
- [startX + perc * (endX - startX), startY + perc * (endY - startY)];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement