MCPcopy
hub / github.com/txstc55/ugly-avatar / cubicBezier

Function cubicBezier

src/utils/eye_shape.js:6–10  ·  view source on GitHub ↗
(P0, P1, P2, P3, t)

Source from the content-addressed store, hash-verified

4}
5
6function 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
12function generateEyeParameters(width) {
13 let height_upper = Math.random() * width / 1.2;// Less height for the upper eyelid to make it sharper

Callers 1

generateEyePointsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected