Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

nasal-canvas

БесплатноБез исполняемых скриптовНе проверен

Provides practical guidance for creating, populating, styling, transforming, updating, and troubleshooting FlightGear Canvas interfaces with Nasal, including…

container32от container32152 установки в других каталогах

Об этом скилле

Nasal Canvas

FlightGear Canvas is a 2D, OpenGL-backed rendering system exposed to Nasal. A Canvas is an off-screen texture/rendering context; a placement makes that texture visible in the FlightGear scene. Its scene graph is hierarchical:

  • A Canvas owns a root group.
  • Groups contain child elements and other groups.
  • Common element types are group, text, path, image, and map.
  • Element properties control rendering and behavior through the FlightGear property tree.
  • Canvas uses Nasal, not JavaScript.
  • The SVG parser translates a supported subset of SVG/XML into Canvas elements; it is not a browser-grade SVG renderer.

When a task involves placing a Canvas in an aircraft or scene, consult the relevant FlightGear Canvas placement/how-to documentation and the current source API. Scenery-object placement has special requirements and uses the scenery object's _module_id in its load handler; do not assume ordinary placement parameters are sufficient.

Choosing how to populate a Canvas

There are two main approaches:

  1. Load SVG when the artwork is primarily static, is easier to author in a vector editor such as Inkscape, or needs named elements that Nasal can later modify.
  2. Build elements in Nasal when geometry is dynamic, generated from simulation data, or benefits from programmatic control.
  3. Use canvas.draw for common higher-level shapes, scales, marks, and transforms instead of manually assembling every primitive.
  4. Use raster images for artwork that does not need vector-level dynamic editing. For frequent pixel changes, use image pixel operations rather than creating a very large number of path elements.

Choose based on maintainability and update cost. A large collection of individual vector elements may be slower than rendering a single image because elements need geometry processing and rendering when the Canvas updates.

Creating and managing a Canvas

The usual workflow is:

  1. Create the Canvas using the relevant Canvas/window or aircraft-instrument setup API.
  2. Configure its dimensions, view, rendering options, and background as needed.
  3. Create a root or named group.
  4. Add child elements or parse an SVG into a group.
  5. Retain handles to elements that will be updated later.
  6. Attach a placement so the Canvas is visible.
  7. Update only the parts that need to change, and delete objects when their lifecycle ends.

Useful Canvas-level operations documented in the source include:

  • createGroup([name]): create a group under the Canvas.
  • setColorBackground(r, g, b, a): set the Canvas background.
  • set(setting, value): configure settings such as name, size, view, mipmapping, additive-blend, coverage-samples, color-samples, freeze, render-always, and update.
  • get(name): retrieve a Canvas by name.
  • getPath(): obtain its property path for use as an image source.
  • parsesvg(group, file[, font-mapper]): parse SVG into a target group.
  • del(): delete the Canvas.

The source documentation marks some methods/settings as uncertain or incompletely documented (for example wrapCanvas, getPath details, and whether every Canvas setting can be changed after initialization). Do not invent behavior for these; check the current implementation when they matter.

Shared Element behavior

Most Canvas element types inherit common Element operations.

Visibility and lifecycle

  • getVisible() returns visibility state.
  • setVisible([visible]), show(), hide(), and toggleVisibility() control visibility.
  • update() requests an update in the current frame; ordinarily changes are reflected in the next frame. Visibility changes are documented as taking effect in the current frame.
  • del() deletes the element.

Geometry and transforms

The documented element transform model has two transformation matrices: the first is applied before the second.

  • createTransform([matrix]) adds a transform; the optional matrix is a six-value affine transform [a, b, c, d, e, f].
  • setRotation(x, y) rotates around the element's configured center and uses the first transform.
  • setTranslation(x, y) translates using the second transform.
  • setScale(x, y) scales using the second transform.
  • getScale() returns [x, y].
  • setCenter(x, y), getCenter(), and updateCenter() manage the rotation center.
  • getBoundingBox() returns [minX, minY, maxX, maxY].

Rotation is around the local origin unless a center is established. For rotation around an arbitrary point, account for the center explicitly. SVG rotation centers authored in Inkscape may be imported and used by setRotation. Keep transform order in mind: for example, a roll rotation and pitch translation often need to be applied in a deliberate order.

Draw order

Canvas normally uses element creation/storage order: later elements are drawn on top. The z-index property can explicitly control ordering; higher values draw later and cover lower values. When sibling path

Полный SKILL.md на ClawHub

Установить nasal-canvas в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл nasal-canvas?

Provides practical guidance for creating, populating, styling, transforming, updating, and troubleshooting FlightGear Canvas interfaces with Nasal, including native Canvas elements, canvas.draw helpers, maps, raster images, and SVG parsing.

Как установить скилл nasal-canvas?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл nasal-canvas запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить nasal-canvas с