cheat/dev

@property (variáveis tipadas)

Registra uma variável CSS com tipo, valor inicial e herança, permitindo animá-la.

Sintaxe

@property --angulo { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

Variáveis normais são texto e não animam. Com @property o navegador sabe o tipo (<angle>, <color>, <length>, <percentage>) e consegue interpolar: dá para animar gradientes, ângulos e cores, algo impossível antes.

Exemplo

@property --giro { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

.borda-animada {
  border: 3px solid transparent;
  background: linear-gradient(#111 0 0) padding-box,
              conic-gradient(from var(--giro), #2f6fed, #e4572e, #2f6fed) border-box;
  animation: gira 3s linear infinite;
}
@keyframes gira { to { --giro: 360deg; } }