expressiveLibraryShape function
shape as MaterialShapes.kt builds it, before .normalized().
Implementation
ExpressiveRoundedPolygon expressiveLibraryShape(ExpressiveMaterialShape shape) {
switch (shape) {
case ExpressiveMaterialShape.circle:
return ExpressiveRoundedPolygon.circle(
numVertices: 10,
radius: 1.0,
centerX: 0.0,
centerY: 0.0,
);
case ExpressiveMaterialShape.square:
return ExpressiveRoundedPolygon.rectangle(
width: 1.0,
height: 1.0,
rounding: ExpressiveCornerRounding(radius: 0.3),
centerX: 0.0,
centerY: 0.0,
);
case ExpressiveMaterialShape.slanted:
return expressiveCustomPolygon(
reps: 2,
centerX: 0.5,
centerY: 0.5,
mirroring: false,
points: <ExpressivePointNRound>[
ExpressivePointNRound(
0.926,
0.97,
ExpressiveCornerRounding(radius: 0.189, smoothing: 0.811),
),
ExpressivePointNRound(
-0.021,
0.967,
ExpressiveCornerRounding(radius: 0.187, smoothing: 0.057),
),
],
);
case ExpressiveMaterialShape.arch:
return expressiveRotated(
ExpressiveRoundedPolygon.fromVerticesNum(
4,
radius: 1.0,
centerX: 0.0,
centerY: 0.0,
rounding: ExpressiveCornerRounding.unrounded,
perVertexRounding: <ExpressiveCornerRounding>[
ExpressiveCornerRounding(radius: 1.0),
ExpressiveCornerRounding(radius: 1.0),
ExpressiveCornerRounding(radius: 0.2),
ExpressiveCornerRounding(radius: 0.2),
],
),
-135.0,
);
case ExpressiveMaterialShape.fan:
return expressiveCustomPolygon(
reps: 1,
centerX: 0.5,
centerY: 0.5,
mirroring: false,
points: <ExpressivePointNRound>[
ExpressivePointNRound(
1.004,
1.0,
ExpressiveCornerRounding(radius: 0.148, smoothing: 0.417),
),
ExpressivePointNRound(
0.0,
1.0,
ExpressiveCornerRounding(radius: 0.151),
),
ExpressivePointNRound(
0.0,
-0.003,
ExpressiveCornerRounding(radius: 0.148),
),
ExpressivePointNRound(
0.978,
0.02,
ExpressiveCornerRounding(radius: 0.803),
),
],
);
case ExpressiveMaterialShape.arrow:
return expressiveCustomPolygon(
reps: 1,
centerX: 0.5,
centerY: 0.5,
mirroring: false,
points: <ExpressivePointNRound>[
ExpressivePointNRound(
0.5,
0.892,
ExpressiveCornerRounding(radius: 0.313),
),
ExpressivePointNRound(
-0.216,
1.05,
ExpressiveCornerRounding(radius: 0.207),
),
ExpressivePointNRound(
0.499,
-0.16,
ExpressiveCornerRounding(radius: 0.215, smoothing: 1.0),
),
ExpressivePointNRound(
1.225,
1.06,
ExpressiveCornerRounding(radius: 0.211),
),
],
);
case ExpressiveMaterialShape.semiCircle:
return ExpressiveRoundedPolygon.rectangle(
width: 1.6,
height: 1.0,
rounding: ExpressiveCornerRounding.unrounded,
perVertexRounding: <ExpressiveCornerRounding>[
ExpressiveCornerRounding(radius: 0.2),
ExpressiveCornerRounding(radius: 0.2),
ExpressiveCornerRounding(radius: 1.0),
ExpressiveCornerRounding(radius: 1.0),
],
centerX: 0.0,
centerY: 0.0,
);
case ExpressiveMaterialShape.oval:
return expressiveRotated(
expressiveScaled(
ExpressiveRoundedPolygon.circle(
numVertices: 8,
radius: 1.0,
centerX: 0.0,
centerY: 0.0,
),
1.0,
0.64,
),
-45.0,
);
case ExpressiveMaterialShape.pill:
return expressiveCustomPolygon(
reps: 2,
centerX: 0.5,
centerY: 0.5,
mirroring: true,
points: <ExpressivePointNRound>[
ExpressivePointNRound(
0.961,
0.039,
ExpressiveCornerRounding(radius: 0.426),
),
ExpressivePointNRound(1.001, 0.428),
ExpressivePointNRound(
1.0,
0.609,
ExpressiveCornerRounding(radius: 1.0),
),
],
);
case ExpressiveMaterialShape.triangle:
return expressiveRotated(
ExpressiveRoundedPolygon.fromVerticesNum(
3,
radius: 1.0,
centerX: 0.0,
centerY: 0.0,
rounding: ExpressiveCornerRounding(radius: 0.2),
),
-90.0,
);
case ExpressiveMaterialShape.diamond:
return expressiveCustomPolygon(
reps: 2,
centerX: 0.5,
centerY: 0.5,
mirroring: false,
points: <ExpressivePointNRound>[
ExpressivePointNRound(
0.5,
1.096,
ExpressiveCornerRounding(radius: 0.151, smoothing: 0.524),
),
ExpressivePointNRound(
0.04,
0.5,
ExpressiveCornerRounding(radius: 0.159),
),
],
);
case ExpressiveMaterialShape.clamShell:
return expressiveCustomPolygon(
reps: 2,
centerX: 0.5,
centerY: 0.5,
mirroring: false,
points: <ExpressivePointNRound>[
ExpressivePointNRound(
0.171,
0.841,
ExpressiveCornerRounding(radius: 0.159),
),
ExpressivePointNRound(
-0.02,
0.5,
ExpressiveCornerRounding(radius: 0.14),
),
ExpressivePointNRound(
0.17,
0.159,
ExpressiveCornerRounding(radius: 0.159),
),
],
);
case ExpressiveMaterialShape.pentagon:
return expressiveCustomPolygon(
reps: 1,
centerX: 0.5,
centerY: 0.5,
mirroring: true,
points: <ExpressivePointNRound>[
ExpressivePointNRound(
0.5,
-0.009,
ExpressiveCornerRounding(radius: 0.172),
),
ExpressivePointNRound(
1.03,
0.365,
ExpressiveCornerRounding(radius: 0.164),
),
ExpressivePointNRound(
0.828,
0.97,
ExpressiveCornerRounding(radius: 0.169),
),
],
);
case ExpressiveMaterialShape.gem:
return expressiveCustomPolygon(
reps: 1,
centerX: 0.5,
centerY: 0.5,
mirroring: true,
points: <ExpressivePointNRound>[
ExpressivePointNRound(
0.499,
1.023,
ExpressiveCornerRounding(radius: 0.241, smoothing: 0.778),
),
ExpressivePointNRound(
-0.005,
0.792,
ExpressiveCornerRounding(radius: 0.208),
),
ExpressivePointNRound(
0.073,
0.258,
ExpressiveCornerRounding(radius: 0.228),
),
ExpressivePointNRound(
0.433,
0.0,
ExpressiveCornerRounding(radius: 0.491),
),
],
);
case ExpressiveMaterialShape.sunny:
return ExpressiveRoundedPolygon.star(
numVerticesPerRadius: 8,
radius: 1.0,
innerRadius: 0.8,
rounding: ExpressiveCornerRounding(radius: 0.15),
centerX: 0.0,
centerY: 0.0,
);
case ExpressiveMaterialShape.verySunny:
return expressiveCustomPolygon(
reps: 8,
centerX: 0.5,
centerY: 0.5,
mirroring: false,
points: <ExpressivePointNRound>[
ExpressivePointNRound(
0.5,
1.08,
ExpressiveCornerRounding(radius: 0.085),
),
ExpressivePointNRound(
0.358,
0.843,
ExpressiveCornerRounding(radius: 0.085),
),
],
);
case ExpressiveMaterialShape.cookie4Sided:
return expressiveCustomPolygon(
reps: 4,
centerX: 0.5,
centerY: 0.5,
mirroring: false,
points: <ExpressivePointNRound>[
ExpressivePointNRound(
1.237,
1.236,
ExpressiveCornerRounding(radius: 0.258),
),
ExpressivePointNRound(
0.5,
0.918,
ExpressiveCornerRounding(radius: 0.233),
),
],
);
case ExpressiveMaterialShape.cookie6Sided:
return expressiveCustomPolygon(
reps: 6,
centerX: 0.5,
centerY: 0.5,
mirroring: false,
points: <ExpressivePointNRound>[
ExpressivePointNRound(
0.723,
0.884,
ExpressiveCornerRounding(radius: 0.394),
),
ExpressivePointNRound(
0.5,
1.099,
ExpressiveCornerRounding(radius: 0.398),
),
],
);
case ExpressiveMaterialShape.cookie7Sided:
return expressiveRotated(
ExpressiveRoundedPolygon.star(
numVerticesPerRadius: 7,
radius: 1.0,
innerRadius: 0.75,
rounding: ExpressiveCornerRounding(radius: 0.5),
centerX: 0.0,
centerY: 0.0,
),
-90.0,
);
case ExpressiveMaterialShape.cookie9Sided:
return expressiveRotated(
ExpressiveRoundedPolygon.star(
numVerticesPerRadius: 9,
radius: 1.0,
innerRadius: 0.8,
rounding: ExpressiveCornerRounding(radius: 0.5),
centerX: 0.0,
centerY: 0.0,
),
-90.0,
);
case ExpressiveMaterialShape.cookie12Sided:
return expressiveRotated(
ExpressiveRoundedPolygon.star(
numVerticesPerRadius: 12,
radius: 1.0,
innerRadius: 0.8,
rounding: ExpressiveCornerRounding(radius: 0.5),
centerX: 0.0,
centerY: 0.0,
),
-90.0,
);
case ExpressiveMaterialShape.ghostish:
return expressiveCustomPolygon(
reps: 1,
centerX: 0.5,
centerY: 0.5,
mirroring: true,
points: <ExpressivePointNRound>[
ExpressivePointNRound(
0.5,
0.0,
ExpressiveCornerRounding(radius: 1.0),
),
ExpressivePointNRound(
1.0,
0.0,
ExpressiveCornerRounding(radius: 1.0),
),
ExpressivePointNRound(
1.0,
1.14,
ExpressiveCornerRounding(radius: 0.254, smoothing: 0.106),
),
ExpressivePointNRound(
0.575,
0.906,
ExpressiveCornerRounding(radius: 0.253),
),
],
);
case ExpressiveMaterialShape.clover4Leaf:
return expressiveCustomPolygon(
reps: 4,
centerX: 0.5,
centerY: 0.5,
mirroring: true,
points: <ExpressivePointNRound>[
ExpressivePointNRound(0.5, 0.074),
ExpressivePointNRound(
0.725,
-0.099,
ExpressiveCornerRounding(radius: 0.476),
),
],
);
case ExpressiveMaterialShape.clover8Leaf:
return expressiveCustomPolygon(
reps: 8,
centerX: 0.5,
centerY: 0.5,
mirroring: false,
points: <ExpressivePointNRound>[
ExpressivePointNRound(0.5, 0.036),
ExpressivePointNRound(
0.758,
-0.101,
ExpressiveCornerRounding(radius: 0.209),
),
],
);
case ExpressiveMaterialShape.burst:
return expressiveCustomPolygon(
reps: 12,
centerX: 0.5,
centerY: 0.5,
mirroring: false,
points: <ExpressivePointNRound>[
ExpressivePointNRound(
0.5,
-0.006,
ExpressiveCornerRounding(radius: 0.006),
),
ExpressivePointNRound(
0.592,
0.158,
ExpressiveCornerRounding(radius: 0.006),
),
],
);
case ExpressiveMaterialShape.softBurst:
return expressiveCustomPolygon(
reps: 10,
centerX: 0.5,
centerY: 0.5,
mirroring: false,
points: <ExpressivePointNRound>[
ExpressivePointNRound(
0.193,
0.277,
ExpressiveCornerRounding(radius: 0.053),
),
ExpressivePointNRound(
0.176,
0.055,
ExpressiveCornerRounding(radius: 0.053),
),
],
);
case ExpressiveMaterialShape.boom:
return expressiveCustomPolygon(
reps: 15,
centerX: 0.5,
centerY: 0.5,
mirroring: false,
points: <ExpressivePointNRound>[
ExpressivePointNRound(
0.457,
0.296,
ExpressiveCornerRounding(radius: 0.007),
),
ExpressivePointNRound(
0.5,
-0.051,
ExpressiveCornerRounding(radius: 0.007),
),
],
);
case ExpressiveMaterialShape.softBoom:
return expressiveCustomPolygon(
reps: 16,
centerX: 0.5,
centerY: 0.5,
mirroring: true,
points: <ExpressivePointNRound>[
ExpressivePointNRound(0.733, 0.454),
ExpressivePointNRound(
0.839,
0.437,
ExpressiveCornerRounding(radius: 0.532),
),
ExpressivePointNRound(
0.949,
0.449,
ExpressiveCornerRounding(radius: 0.439, smoothing: 1.0),
),
ExpressivePointNRound(
0.998,
0.478,
ExpressiveCornerRounding(radius: 0.174),
),
],
);
case ExpressiveMaterialShape.flower:
return expressiveCustomPolygon(
reps: 8,
centerX: 0.5,
centerY: 0.5,
mirroring: true,
points: <ExpressivePointNRound>[
ExpressivePointNRound(0.37, 0.187),
ExpressivePointNRound(
0.416,
0.049,
ExpressiveCornerRounding(radius: 0.381),
),
ExpressivePointNRound(
0.479,
0.001,
ExpressiveCornerRounding(radius: 0.095),
),
],
);
case ExpressiveMaterialShape.puffy:
return expressiveScaled(
expressiveCustomPolygon(
reps: 2,
centerX: 0.5,
centerY: 0.5,
mirroring: true,
points: <ExpressivePointNRound>[
ExpressivePointNRound(0.5, 0.053),
ExpressivePointNRound(
0.545,
-0.04,
ExpressiveCornerRounding(radius: 0.405),
),
ExpressivePointNRound(
0.67,
-0.035,
ExpressiveCornerRounding(radius: 0.426),
),
ExpressivePointNRound(
0.717,
0.066,
ExpressiveCornerRounding(radius: 0.574),
),
ExpressivePointNRound(0.722, 0.128),
ExpressivePointNRound(
0.777,
0.002,
ExpressiveCornerRounding(radius: 0.36),
),
ExpressivePointNRound(
0.914,
0.149,
ExpressiveCornerRounding(radius: 0.66),
),
ExpressivePointNRound(
0.926,
0.289,
ExpressiveCornerRounding(radius: 0.66),
),
ExpressivePointNRound(0.881, 0.346),
ExpressivePointNRound(
0.94,
0.344,
ExpressiveCornerRounding(radius: 0.126),
),
ExpressivePointNRound(
1.003,
0.437,
ExpressiveCornerRounding(radius: 0.255),
),
],
),
1.0,
0.742,
);
case ExpressiveMaterialShape.puffyDiamond:
return expressiveCustomPolygon(
reps: 4,
centerX: 0.5,
centerY: 0.5,
mirroring: true,
points: <ExpressivePointNRound>[
ExpressivePointNRound(
0.87,
0.13,
ExpressiveCornerRounding(radius: 0.146),
),
ExpressivePointNRound(0.818, 0.357),
ExpressivePointNRound(
1.0,
0.332,
ExpressiveCornerRounding(radius: 0.853),
),
],
);
case ExpressiveMaterialShape.pixelCircle:
return expressiveCustomPolygon(
reps: 2,
centerX: 0.5,
centerY: 0.5,
mirroring: true,
points: <ExpressivePointNRound>[
ExpressivePointNRound(0.5, 0.0),
ExpressivePointNRound(0.704, 0.0),
ExpressivePointNRound(0.704, 0.065),
ExpressivePointNRound(0.843, 0.065),
ExpressivePointNRound(0.843, 0.148),
ExpressivePointNRound(0.926, 0.148),
ExpressivePointNRound(0.926, 0.296),
ExpressivePointNRound(1.0, 0.296),
],
);
case ExpressiveMaterialShape.pixelTriangle:
return expressiveCustomPolygon(
reps: 1,
centerX: 0.5,
centerY: 0.5,
mirroring: true,
points: <ExpressivePointNRound>[
ExpressivePointNRound(0.11, 0.5),
ExpressivePointNRound(0.113, 0.0),
ExpressivePointNRound(0.287, 0.0),
ExpressivePointNRound(0.287, 0.087),
ExpressivePointNRound(0.421, 0.087),
ExpressivePointNRound(0.421, 0.17),
ExpressivePointNRound(0.56, 0.17),
ExpressivePointNRound(0.56, 0.265),
ExpressivePointNRound(0.674, 0.265),
ExpressivePointNRound(0.675, 0.344),
ExpressivePointNRound(0.789, 0.344),
ExpressivePointNRound(0.789, 0.439),
ExpressivePointNRound(0.888, 0.439),
],
);
case ExpressiveMaterialShape.bun:
return expressiveCustomPolygon(
reps: 2,
centerX: 0.5,
centerY: 0.5,
mirroring: true,
points: <ExpressivePointNRound>[
ExpressivePointNRound(0.796, 0.5),
ExpressivePointNRound(
0.853,
0.518,
ExpressiveCornerRounding(radius: 1.0),
),
ExpressivePointNRound(
0.992,
0.631,
ExpressiveCornerRounding(radius: 1.0),
),
ExpressivePointNRound(
0.968,
1.0,
ExpressiveCornerRounding(radius: 1.0),
),
],
);
case ExpressiveMaterialShape.heart:
return expressiveCustomPolygon(
reps: 1,
centerX: 0.5,
centerY: 0.5,
mirroring: true,
points: <ExpressivePointNRound>[
ExpressivePointNRound(
0.5,
0.268,
ExpressiveCornerRounding(radius: 0.016),
),
ExpressivePointNRound(
0.792,
-0.066,
ExpressiveCornerRounding(radius: 0.958),
),
ExpressivePointNRound(
1.064,
0.276,
ExpressiveCornerRounding(radius: 1.0),
),
ExpressivePointNRound(
0.501,
0.946,
ExpressiveCornerRounding(radius: 0.129),
),
],
);
}
}