This commit is contained in:
Jose Conde
2024-07-22 21:04:51 +02:00
parent a8d6129d3e
commit cd5f4ad91a
38 changed files with 1311 additions and 182 deletions

View File

@ -57,19 +57,19 @@ export const scoreText = new TextStyle({
function getStyle(styleOptions: TextStyleOptions = {}) {
const {
fill = 0xa2a2a2,
stroke = 0x565656,
fontSize = 15,
fontFamily = 'Arial, Helvetica, sans-serif',
fontWeight = 'normal',
fontStyle = 'normal',
dropShadow,
letterSpacing = 1,
stroke,
} = styleOptions
const style = new TextStyle({
fill,
fontFamily,
letterSpacing,
stroke,
stroke: stroke ? stroke : undefined,
fontSize,
fontStyle,
fontWeight: fontWeight as any,
@ -78,6 +78,20 @@ function getStyle(styleOptions: TextStyleOptions = {}) {
return style
}
const styleFactory = (fill: number) => {
return (
fontSize: number = 15,
fontWeight: TextStyleFontWeight = 'normal',
dropShadow: boolean = false,
) =>
getStyle({
fill,
fontSize,
fontWeight,
dropShadow,
})
}
export const whiteStyle = (
fontSize: number = 15,
fontWeight: TextStyleFontWeight = 'normal',
@ -101,6 +115,8 @@ export const yellowStyle = (
dropShadow,
})
export const grayStyle = styleFactory(0x444444)
interface TextOptions {
text: string
x: number