React Super Tilemap is a low-level tilemap rendering engine for React, optimized for browser performance.
Ideal for games and apps that require:
- Grid-based map rendering.
- Camera control and zooming.
- Support for animated, oversized, and offset sprites.
- Dynamic movable elements.
npm install react-super-tilemap
# or
yarn add react-super-tilemap
API Reference: 📜 SpriteDefinition
const sprites: SpriteDefinition[] = [
{
key: 'grass',
imageSrc: ['path/to/grass.png'],
},
]
{
key: 'ocean',
imageSrc: [ocean_1, ocean_2, ocean_3, ocean_4],
animationDelay: 400,
}
⚠️ All animation images must be the same size.
{
key: 'building',
imageSrc: [building_1],
animationDelay: 800,
size: { width: 1, height: 2 },
}
{
key: 'selector',
imageSrc: [selector1, selector2],
animationDelay: 800,
size: { width: 2, height: 2 },
offset: { col: -0.5, row: 0.5 },
}
API Reference: 📜 Tilemap API
<Tilemap tilmapScheme={scheme} spriteDefinition={sprites}>
...
</Tilemap>
<ManualCamera position={{ col: 0, row: 0 }} zoom={0} />
<ThirdPersonCamera />
const { addZoomMotion } = useThirdPersonCameraContext()
<ManualElement
elementKey="unit"
spriteKey="armyIdle"
layer={1}
tilePosition={{ x: 0, y: 0 }}
/>
<MotionableElement
elementKey="unit"
spriteKey="armyIdle"
layer={1}
tilePosition={{ x: 5, y: 5 }}
motionSettings={{ speed: 1, easing: 'linear' }}
/>