Index of every page on this site: llms.txt
All skills
oahc09 avatar

/cocosair-ui-2d

@ed38648
by oahc09oahc09/cocosairjs3 stars
2
Run it yourself

Build Canvas UI with sprites, Label text, layout and widgets. Use for missing UI, viewport alignment, 2D draw order, BMFont binding or AIR_E_LABEL_WRAP.

  • 10 files
  • 39.1 KB
  • MIT
  • Updated last month
  • GitHub
Use this Skill: https://skilld.dev/gh/oahc09/cocosairjs/cocosair-ui-2d

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencestriggers.md

≈343 tokens on demand. Your agent reads this file only when SKILL.md points to it.

2D UI contracts triggers

For original references to the contracts below, see Contracts. Source annotations refer to the AIR checkout.

When to use what

  • "put UI on screen" -> createUICanvas(scene, name, { designWidth, designHeight, layer }); it wires Canvas + Widget + ortho camera in one call (src/air/ui-kit.ts:37-67).
  • "a colored panel / image" -> spriteNode(parent, name, { size, position, color, layer }), then assign sprite.spriteFrame; set SizeMode.CUSTOM before the frame (src/air/ui-kit.ts:81-93, docs/manual/2d-ui.md:62-66).
  • "on-screen text" -> labelNode(parent, text, name, { fontSize, position, color, overflow, enableWrapText, boxSize }); system font unless you bind a BMFont (src/air/ui-kit.ts:111-131).
  • "align to an edge / fill the screen" -> Widget with isAlignLeft/Right/Top/Bottom and alignMode (src/cocos/ui/widget.ts:123-148).
  • "auto-stack or grid children" -> Layout (Layout.Type, Layout.ResizeMode, Layout.VerticalDirection) (src/cocos/ui/layout.ts:214, :619-644).
  • "buttons, sliders, scrolling" -> Button, Slider, ProgressBar, ScrollView, Toggle, EditBox, PageView; each also aliased ...Component (widgets.md).
  • "wrong 2D overlap" -> Sorting2D (needs a UIRenderer) writes uiRenderer.priority from SortingLayers (sorting.md).

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at ed38648. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last month
layer
subsystem
All 1 allowed tools
Read Edit Write Bash
Other metadata
compatibility
Cocos AIR source checkout or installed cocosair.js package. Browser rendering requires WebGL 2; source tooling requires Node.js >=18. Use the host-provided tools and user-authorized workspace.
when_to_use
[
  "put sprites, labels or controls on screen",
  "UI renders nothing despite visible nodes",
  "widgets must realign after a viewport change",
  "bind an existing bitmap font to Label",
  "2D sprites and labels overlap in the wrong order"
]
owns
[
  "ui-canvas",
  "sprite-label",
  "widget-layout",
  "ui-controls",
  "font-binding",
  "sorting-2d"
]
not_for
[
  "load or parse a bitmap font -> cocosair-assets",
  "sprite masks and DOM overlays -> cocosair-graphics-and-dom",
  "native input and action mapping -> cocosair-input-action"
]
metadata
{
  "author": "oahc09@gmail.com",
  "version": "1.0.0",
  "last-updated": "2026-10-13",
  "description_zh": "使用 Canvas、布局、控件、Label、位图字体和二维排序。用于 UI 构建、文本显示或交互布局问题。"
}

README badge

README badge for oahc09/cocosairjs/cocosair-ui-2d