Animate Custom Property
Preview
Code
<style>
@property --angle{
syntax: "<angle>";
inherits: false;
initial-value: 0deg;
}
.box{
width:120px;
height:80px;
background:#22c55e;
transform:rotate(var(--angle));
animation:spin 2s linear infinite;
}
@keyframes spin{
from{--angle:0deg;}
to{--angle:360deg;}
}
</style>
<div class="box"></div>