(P0, P1, P2, P3, t)
| 4 | } |
| 5 | |
| 6 | function cubicBezier(P0, P1, P2, P3, t) { |
| 7 | var x = (1 - t) ** 3 * P0[0] + 3 * (1 - t) ** 2 * t * P1[0] + 3 * (1 - t) * t ** 2 * P2[0] + t ** 3 * P3[0]; |
| 8 | var y = (1 - t) ** 3 * P0[1] + 3 * (1 - t) ** 2 * t * P1[1] + 3 * (1 - t) * t ** 2 * P2[1] + t ** 3 * P3[1]; |
| 9 | return [x, y]; |
| 10 | } |
| 11 | |
| 12 | function generateEyeParameters(width) { |
| 13 | let height_upper = Math.random() * width / 1.2;// Less height for the upper eyelid to make it sharper |