Valyro English version

Pixel Painter

Рисование на пиксельной сетке и экспорт PNG. Бесплатно, MIT · Интерактивные блоки › Мини-редакторы и расчёты

Установка

npx valyro-cli@latest add pixel-painter
npx shadcn@latest add https://valyro.xyz/r/pixel-painter.json
npm install valyro-ui

import 'valyro-ui/styles.css';
import { PixelPainter } from 'valyro-ui';

Пропсы

PropTypeDefault
valuePixelDocumentThe picture: grid size, palette and cells (palette indexes, row by row).
defaultValuePixelDocumentInitial picture when uncontrolled. Default: a transparent 16 × 16 grid with ten colours.
onValueChange(value: PixelDocument) => voidCalled with the new picture when a stroke, fill, undo or redo completes.
toolsPixelTool[]ALL_TOOLSTools on the toolbar, in order. Default: pencil, eraser, fill, picker.
activeColorIndexnumberPalette index of the drawing colour.
defaultActiveColorIndexnumberInitial drawing colour when uncontrolled. Default: the first opaque palette entry.
onActiveColorIndexChange(index: number) => voidCalled with the new activeColorIndex when it changes.
historyLimitnumber50Most undoable actions. Default 50.
exportScalenumber1Whole-number size factor of the PNG, 1…64; each cell becomes scale × scale pixels without smoothing. Default 1.
onExport(blob: Blob) => voidReceives the PNG. Without it, the save button downloads the file.
fileNamestring'pixel-art.png'Name of the downloaded file. Default pixel-art.png.
labelsPartial<PixelPainterLabels>Overrides for the built-in English text; keys left out keep their defaults.

Похожие компоненты

  • Gradient Mixer — Цветовые точки на холсте и экспорт многослойного CSS-градиента
  • Crafting Recipe — Карточка рецепта: сборки, расход ингредиентов и нехватка
  • Feature Hotspots — Точки на изображении: нажатие открывает пояснение к детали
  • Exploded Layers — Подготовленные слои изображения раздвигаются с подписями
  • Prediction Card — Сначала предположение читателя, затем ответ и разбор
  • Detail Dial — Выбор глубины объяснения: кратко, подробно, полный разбор
  • Version Scrubber — Просмотр подготовленных версий одним ползунком
  • Page Minimap — Мини-карта длинной страницы с видимой областью
  • Peel Sticker — Наклейка отклеивается за угол и открывает содержимое
  • Scratch Reveal — Стираемое покрытие над текстом или картинкой
  • Tear-off Ticket — Билет с корешком, который отрывается по перфорации
  • Split-Flap Board — Механическое табло: перелистываются только изменившиеся символы

Назад: Gradient Mixer · Далее: Crafting Recipe · Весь раздел «Интерактивные блоки»