Page 1 of 1

Looped Hintergrundanimation ohne Einstellung der PX -Position

Posted: 12 Apr 2025, 15:25
by Anonymous
ein

Code: Select all

@keyframes anim
{
from    {   background-position: 0 0;               }
to      {   background-position: 256px 256px;       }
}

div
{
background-image: url('256.png');
width: 256px;
height: 256px;
background-size: 256px 256px;
background-repeat: repeat;
animation: anim 5s linear infinite;
}
… wobei 256px 256px in Hintergrundposition aus dem Bild extrahiert werden (aus dem Bild (

Code: Select all

256.png
) durch den Vorprozessor. Soweit ich weiß, kann ich keinen Prozentsatz für die Hintergrundposition verwenden, während der Container und das Bild beide die gleiche Größe haben.