Cómo funciona
Una figura de libro de texto sobre un patrón periódico. La celda tintada con contorno de tinta es el original; la figura muestra ocho copias. Dibuja en cualquier punto y el trazo se pliega al original, así que todas las copias lo repiten. Con Trasladar cada copia es el original desplazado celdas enteras (grupo p1); con Espejo una columna de cada dos se refleja en la junta vertical (pm); con Dos espejos las copias se reflejan en todas las juntas (pmm). Un punto en cada junta indica si la copia vecina continúa la línea: tinta si sigue, anillo rojo si se corta.
Úsalo para
- Teach translation and reflection symmetry: why a wave repeats under any symmetry while a slanted line only joins up into a zigzag with mirrors.
- Let learners design a repeating motif and check that it tiles without breaks before using it as a border, fabric or wallpaper.
Busca otra opción cuando
- For rotations, glide reflections or non-square cells, use a full wallpaper-group tool: this one covers p1, pm and pmm on a square cell.
Uso
import React, { useState } from 'react'
import { WovenSeamStudio } from './WovenSeamStudio.jsx'
export function TilingLesson() {
const [strokes, setStrokes] = useState([])
const [seams, setSeams] = useState(null)
return (
<WovenSeamStudio
value={strokes}
onChange={(next, details) => {
setStrokes(next)
setSeams(details.seams)
}}
defaultSymmetry="mirror"
/>
)
}Propiedades
| Propiedad | Tipo | Por defecto | Qué hace |
|---|---|---|---|
value | Array<Array<Array<[x, y]>>> | — | Controlled drawing: a list of strokes, each a list of pieces, each a list of points in source-cell units (0–100 on both axes). A stroke that crosses seams is stored as one piece per cell it passed through. |
defaultValue | Array<Array<Array<[x, y]>>> | one wave from the left edge to the right edge | Starting drawing when uncontrolled. Pass [] to start empty. |
onChange | (strokes, { reason, seams: { matched, total } }) => void | — | Called after a stroke is drawn, undone or cleared. reason is 'draw', 'keyboard', 'undo' or 'clear'; seams counts the seam ends and how many of them continue under the current symmetry. |
symmetry | 'translate' | 'mirror' | 'mirror2' | — | Controlled symmetry: translation only (p1), mirrors across the vertical seams (pm), or mirrors across every seam (pmm). |
defaultSymmetry | 'translate' | 'mirror' | 'mirror2' | 'translate' | Starting symmetry when uncontrolled. |
onSymmetryChange | (symmetry) => void | — | Called when the symmetry is changed. |
labels | object | — | Replaces any built-in text: title, formulas ({ translate, mirror, mirror2 }), legendSource, legendMatch, legendOpen, source, canvas, help, keys, symmetry, translate, mirror, mirror2, undo, clear, readout, noSeams, pointAdded ('{n}'), drawn ('{n}', '{matched}', '{total}'), undone, cleared and matchText ('{matched}', '{total}'). |
locale | string | 'en' | Language tag for the numbers. |
className | string | — | Extra class on the card, for example to set its width (30rem by default, never wider than its container). |
Accesibilidad
- The tiling is an application region with its instructions as its description. Arrows move a cross-hair (Shift moves half a cell), Space adds a point, Enter draws the stroke through the points, Backspace removes the last point and Escape drops them. A hint with these keys shows while the tiling has keyboard focus. Control or Command with Z undoes the last stroke.
- A polite status announces each stroke with how many seam ends continue, and the new count when the symmetry changes.
- The symmetry is a radio group: arrows move between Translate, Mirror and Mirror both. Undo and Clear are buttons, marked unavailable when there is nothing to remove.
- Drawing uses pointer capture and touch-action none on the tiling only; a cancelled gesture draws nothing.
Movimiento
When the symmetry changes, the mirrored copies flip over for --ds-duration-base; while drawing, every copy follows the pointer at once. With reduced motion there is no animation.
Añádelo a tu proyecto
Los miembros Pro copian un prompt y su agente de programación instala el código, igual que con los gratuitos.
WovenSeamStudio.jsxwoven-seam-studio.csstokens.cssREADME.md
Los dos archivos se instalan juntos. La hoja de estilos lee las variables de tokens.css y lleva valores de reserva, así que también funciona sola.







