Referencia de elementos

Elemento de imagen

1. Estructura

interface ImageClip extends BaseClip {
  type: "image";
  src: string | { $ref: string };
}

2. Campos compatibles

src

  • Tipo: string | { $ref: string }
  • Obligatorio: sí
  • Propósito: URL de imagen o referencia a un recurso de imagen

3. Comportamiento actual del runtime

  • src admite URL directas
  • src admite $ref
  • transform funciona
  • style.borderRadius funciona
  • style.objectFit funciona
  • style.filters funciona

4. style.objectFit

Valores compatibles:

  • fill
  • cover
  • contain

Significado:

  • fill: estira al cuadro de destino y puede deformar
  • cover: conserva la relación de aspecto y puede recortar
  • contain: conserva la relación de aspecto y puede dejar espacio vacío

Ejemplo:

{
  "style": {
    "objectFit": "cover"
  }
}

También puede combinarse con filtros:

{
  "style": {
    "objectFit": "cover",
    "filters": [
      { "type": "blur", "value": 24 }
    ]
  }
}

5. Ejemplo

{
  "type": "image",
  "start": 0.5,
  "duration": 4,
  "src": { "$ref": "logo" },
  "transform": {
    "x": "85%",
    "y": "10%",
    "width": 220,
    "height": 80
  },
  "style": {
    "borderRadius": 16,
    "objectFit": "contain"
  },
  "animations": [
    {
      "type": "fadeIn",
      "duration": 0.5
    }
  ]
}