Motion Blocks

Canvas

Card 3D

OGL-powered 3D card with rounded corners and mouse-tracking parallax rotation.

  • lit Preview of https://lit.devLitSimple. Fast. Web Components.
  • ogl Preview of https://github.com/oframe/oglOGLMinimal WebGL framework.

Preview

OGL-powered 3D card with rounded corners. Move your cursor over it to rotate.
Attributes

Installation

pnpm dlx motion-blocks add card-3d

Usage

---import "@/components/motion-blocks/card-3d-element.ts";--- <motion-card-3d  image="/path/to/image.jpg"  width="3.2"  height="2"  depth="0.08"  radius="0.15"  class="w-full h-[400px]"/>

API Reference

Attribute Type Default
image URL of the image to display on the 3D card. string ""
width Width of the card in 3D space units. number 3.2
height Height of the card in 3D space units. number 2
depth Thickness/depth of the 3D card geometry. number 0.08
radius Corner radius for rounded corners (in 3D space units). number 0.15