Change rem to vh/vw and clean up shapesBySize
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
afece801bf
commit
4e66628fb6
|
@ -175,16 +175,8 @@ const shapesSizes: ShapeSize = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const shapesBySize = {
|
const shapesBySize = {
|
||||||
big: Object.entries(shapesSizes)
|
big: shapeTypes.filter((shape) => shapesSizes[shape]["size"] == "big"),
|
||||||
.map((shape) => shape[0])
|
small: shapeTypes.filter((shape) => shapesSizes[shape]["size"] == "small"),
|
||||||
.filter(
|
|
||||||
(shape) => shapesSizes[shape as ShapeType]["size"] == "big"
|
|
||||||
) as ShapeType[],
|
|
||||||
small: Object.entries(shapesSizes)
|
|
||||||
.map((shape) => shape[0])
|
|
||||||
.filter(
|
|
||||||
(shape) => shapesSizes[shape as ShapeType]["size"] == "small"
|
|
||||||
) as ShapeType[],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Used to generate random shapes in the margins
|
// Used to generate random shapes in the margins
|
||||||
|
@ -217,9 +209,17 @@ export const defaultGetShapesConfig = ((pageWidth, pageHeight) => {
|
||||||
const opacity = getRandomOpacity(colour);
|
const opacity = getRandomOpacity(colour);
|
||||||
|
|
||||||
defaultConfig[shape]?.push({
|
defaultConfig[shape]?.push({
|
||||||
top: `${((y + verticalOffset) / 16).toFixed(5)}rem`,
|
top: `${(((y + verticalOffset) / window.innerHeight) * 100).toFixed(
|
||||||
left: x == 0 ? `${(horizontalOffset / 16).toFixed(5)}rem` : "unset",
|
5
|
||||||
right: x == 1 ? `${(horizontalOffset / 16).toFixed(5)}rem` : "unset",
|
)}vh`,
|
||||||
|
left:
|
||||||
|
x == 0
|
||||||
|
? `${((horizontalOffset / window.innerWidth) * 100).toFixed(5)}vw`
|
||||||
|
: "unset",
|
||||||
|
right:
|
||||||
|
x == 1
|
||||||
|
? `${((horizontalOffset / window.innerWidth) * 100).toFixed(5)}vw`
|
||||||
|
: "unset",
|
||||||
width: `${(shapeWidth / 16).toFixed(5)}rem`,
|
width: `${(shapeWidth / 16).toFixed(5)}rem`,
|
||||||
height: `${(shapeHeight / 16).toFixed(5)}rem`,
|
height: `${(shapeHeight / 16).toFixed(5)}rem`,
|
||||||
transform: `rotate(${angle}deg)`,
|
transform: `rotate(${angle}deg)`,
|
||||||
|
|
Loading…
Reference in New Issue