This example introduces UIText elements alongside images in constraint-based layouts. A character, logotype, download button, and text elements are positioned using aspect and proportion constraints, demonstrating how to combine different UI element types.
new UIText(layer,
// Can be a string, span, or array of spans
"Hello!",
{
padding: { left: 20, right: 20, top: 20, bottom: 20 },
// Common style - default style
commonStyle: {
color: "#ffffff",
fontFamily: "Chewy",
fontSize: 256,
enableShadow: true,
shadowOffsetX: 8,
shadowOffsetY: 8,
shadowBlur: 4,
shadowColor: "#050505",
enableStroke: true,
strokeColor: "#101010",
strokeWidth: 12,
},
}
);
// If a UI element has semi-transparent parts,
// enable transparency instead of alphaTest
text.transparency = true;