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

/cocosair-math

@ed38648
by oahc09oahc09/cocosairjs3 stars
2
Run it yourself

Compute vectors, matrices, quaternions, colors and easing. Use for out-first math, frozen Vec3.UP errors, transform composition, rotation units or Mat4.invert.

  • 9 files
  • 119.9 KB
  • MIT
  • Updated last month
  • GitHub
Use this Skill: https://skilld.dev/gh/oahc09/cocosairjs/cocosair-math

Nothing lands on disk. Nothing to clean up.

Fork this Skill

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

referencestriggers.md

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

Cocos AIR math triggers

Source annotations refer to the AIR checkout.

When to use what

  • "Normalize / length / dot / cross a direction" -> Vec3.normalize, Vec3.len, Vec3.dot, Vec3.cross (src/cocos/core/math/vec3.ts:329, :360); table in value-types.md.
  • "Angle between two vectors" -> Vec3.angle(a, b) RADIANS (src/cocos/core/math/vec3.ts:753), Vec2.angle (src/cocos/core/math/vec2.ts:438); the signed form is Vec3.signedAngle (src/cocos/core/math/vec3.ts:791, table in value-types.md) and there is no Vec2.signedAngle.
  • "Build a transform matrix / read TRS back out" -> Mat4.fromSRT(out, q, v, s) (src/cocos/core/math/mat4.ts:964) and Mat4.toSRT(m, q, v, s) (:878); there is no Mat4.decompose. Element layout in transforms.md.
  • "Rotate a quaternion" -> Quat.fromEuler degrees YZX (src/cocos/core/math/quat.ts:557), Quat.fromAxisAngle radians (:475), Quat.rotationTo (:104).
  • "Point / rect hit test" -> Rect.contains(point: Vec2) (src/cocos/core/math/rect.ts:414), Rect.intersects (:399), Rect.fromMinMax (:56).
  • "Color from a design token string" -> new Color('#ff8000'), Color.fromHEX (src/cocos/core/math/color.ts:150), toCSS/toHEX (:497, :561).
  • "Interpolate a scalar over time" -> lerp/inverseLerp/clamp01/repeat/pingPong (src/cocos/core/math/utils.ts:157, :307, :146, :279, :293).
  • "Pick an easing curve" -> easing.cubicOut and the rest of the 44 functions (src/cocos/core/algorithm/easing.ts, inventory in easing-random.md).
  • "Deterministic random" -> pseudoRandom(seed) (src/cocos/core/math/utils.ts:227); "non-reproducible" -> random/randomRange (:182, :203).
  • "Texture-size rounding / bit math / pack a scalar to 16-bit" -> bits.nextPow2, bits.log2, bits.isPow2 (src/cocos/core/math/bits.ts:151, :101, :93) and floatToHalf/halfToFloat (src/cocos/core/math/utils.ts:417, :421).

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
[
  "normalize or project a direction",
  "compose or decompose a transform matrix",
  "choose quaternion rotation and angle units",
  "convert colors or calculate easing and deterministic random",
  "writing a frozen vector constant throws"
]
owns
[
  "vector-math",
  "matrix-transforms",
  "quaternion",
  "color-values",
  "easing",
  "deterministic-random"
]
not_for
[
  "screen and world camera conversion -> cocosair-camera",
  "native tween playback -> cocosair-animation-tween",
  "node parenting and lifecycle -> cocosair-scene-graph"
]
metadata
{
  "author": "oahc09@gmail.com",
  "version": "1.0.0",
  "last-updated": "2026-10-13",
  "description_zh": "使用 Cocos 数学类型进行向量、矩阵、四元数、颜色和插值计算。用于坐标变换、旋转、颜色处理、缓动或确定性随机。"
}

README badge

README badge for oahc09/cocosairjs/cocosair-math