Created
February 17, 2022 04:51
-
-
Save AndyDentFree/c8c8b11368939869c1422e2ee3ce9c84 to your computer and use it in GitHub Desktop.
Sample showing creating a Touchgram from within code, as part of our test suite.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static func makeManyTextVaryingOutlines(workNum: UInt32) -> tgTouchgram { | |
let fc = tgColor(systemColor: .red) | |
let ec = tgColor(systemColor: .yellow) | |
let pt: UInt16 = 48 | |
let lw:[CGFloat] = Array(stride(from: 0.0, through: 4.0, by: 0.5)) | |
return tgTouchgram(title: "Lots of Text Varying Outlines", scenes: [ | |
tgScene(background: tgColorBackground(fill: tgColor(systemColor: .blue)), | |
triggers: [], | |
nodes: tgNodeList(nodes: [ | |
tgSimpleTextNode(position: tgNodePosition(anchored: .topLeft, paddingPixels: 8), | |
text: "Hi", | |
styleToStash: tgTextStyle(fontName: "Arial", size: pt, traits: .plain, | |
drawStyle: tgDrawStyle(mainColor: fc, optionalColor: ec, lineWidth: lw[0]) | |
)), | |
tgSimpleTextNode(position: tgNodePosition(anchored: .topCentered, paddingPixels: 8), | |
text: "Hello", | |
styleToStash: tgTextStyle(fontName: "Arial", size: pt, traits: .plain, | |
drawStyle: tgDrawStyle(mainColor: fc, optionalColor: ec, lineWidth: lw[1]) | |
)), | |
tgSimpleTextNode(position: tgNodePosition(anchored: .topRight, paddingPixels: 8), | |
text: "Yo", | |
styleToStash: tgTextStyle(fontName: "Arial", size: pt, traits: .plain, | |
drawStyle: tgDrawStyle(mainColor: fc, optionalColor: ec, lineWidth: lw[2]) | |
)), | |
tgSimpleTextNode(position: tgNodePosition(anchored: .centerLeft, paddingPixels: 0), | |
text: "Me", | |
styleToStash: tgTextStyle(fontName: "Arial", size: pt, traits: .plain, | |
drawStyle: tgDrawStyle(mainColor: fc, optionalColor: ec, lineWidth: lw[3]) | |
)), | |
...} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment