Edit Operations
Less than 1 minute
Edit Operations
Basic entity editing operations, including move, copy, rotate, scale, mirror, erase, and more.
Online Examples
| Example | Description | Link |
|---|---|---|
| Move Entity | move method example | Online Demo{target="_blank"} |
| Copy Entity | clone method example | Online Demo{target="_blank"} |
| Rotate Entity | rotate method example | Online Demo{target="_blank"} |
| Scale Entity | scale method example | Online Demo{target="_blank"} |
| Mirror Entity | mirror method example | Online Demo{target="_blank"} |
| Erase Entity | Usage of Engine.eraseEntities | Online Demo{target="_blank"} |
| Draw Order | Adjust draw order with DrawOrder | Online Demo{target="_blank"} |
| Group Operations | GROUP / UNGROUP examples | Online Demo{target="_blank"} |
| Highlight Entities | Usage of highLightEntities and clearHighLight | Online Demo{target="_blank"} |
Core API
Move Entities
// Move entity
entity.move(dx, dy); // Relative move
entity.move(new Point2D(dx, dy)); // Using Point2D
// Batch move
entities.forEach(e => e.move(100, 50));
Engine.regen();Copy Entities
// Clone entity
const cloned = entity.clone();
cloned.move(100, 0); // Move to new position
Engine.addEntities(cloned);Rotate Entities
// Rotate around a point
const center = new Point2D(0, 0);
const angle = Math.PI / 4; // 45 degrees in radians
entity.rotate(center, angle);
Engine.regen();Scale Entities
// Scale around a point
const basePoint = new Point2D(0, 0);
const scaleFactor = 2.0;
entity.scale(basePoint, scaleFactor);
Engine.regen();Mirror Entities
// Mirror along a line
const mirrorLine = {
start: new Point2D(0, 0),
end: new Point2D(0, 100)
};
entity.mirror(mirrorLine.start, mirrorLine.end);
Engine.regen();Erase Entities
// Erase a single entity
Engine.eraseEntities(entity);
// Erase multiple entities
Engine.eraseEntities([entity1, entity2, entity3]);