Skip to content

Projections

polycss uses CSS 3D perspective to project the scene. The perspective attribute on <poly-scene> (or perspective prop on PolyScene / PolyCamera) controls the depth illusion, and rot-x / rot-y control the camera angle.

Use the sliders below to explore how perspective, rotX, and rotY interact.

Loading…

Higher perspective values feel flatter (more isometric-like); lower values exaggerate depth. A value of false gives orthographic projection (no perspective distortion).

<script type="module" src="https://esm.sh/polycss/elements"></script>
<!-- Standard perspective -->
<poly-scene perspective="1000" rot-x="65" rot-y="45">
<poly-mesh src="/cottage.glb"></poly-mesh>
</poly-scene>
<!-- Very flat / near-isometric -->
<poly-scene perspective="8000" rot-x="65" rot-y="45">
<poly-mesh src="/cottage.glb"></poly-mesh>
</poly-scene>
<!-- Orthographic -->
<poly-scene perspective="false" rot-x="65" rot-y="45">
<poly-mesh src="/cottage.glb"></poly-mesh>
</poly-scene>

Use rot-x and rot-y (vanilla) / rotX and rotY (React, Vue) to position the camera:

  • rotX — vertical tilt. 90 is straight-down top view; 0 is horizontal.
  • rotY — horizontal rotation (0–360). Controls which face of the scene is forward.
<!-- Vanilla -->
<poly-scene rot-x="65" rot-y="45"></poly-scene> <!-- Classic isometric angle -->
<poly-scene rot-x="80" rot-y="45"></poly-scene> <!-- More top-down (map view) -->
<poly-scene rot-x="20" rot-y="0"></poly-scene> <!-- Front-facing -->
// React
<PolyScene rotX={65} rotY={45}></PolyScene>
<PolyScene rotX={80} rotY={45}></PolyScene>
<PolyScene rotX={20} rotY={0}></PolyScene>
  • High perspective (≥ 4000): Near-isometric feel, minimal depth distortion. Good for architectural renders or strategy-game-style views.
  • Low perspective (500–1000): Strong depth foreshortening. Good for dramatic close-up shots or first-person-adjacent views.
  • Orthographic (false): Perfect isometric, no depth distortion at all. Good when you need pixel-perfect isometric scenes.