Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Continuous CSS transitions

Is there a way to continuously animate a background image's background-position property using CSS3 transitions?

like image 713
Sinan Avatar asked Sep 01 '12 00:09

Sinan


1 Answers

Yes, it's possible - DEMO

div
{
    background: url(http://lorempixel.com/100/100);
    height: 100px;
    width: 100px;

    -webkit-animation: slide 2s linear infinite;
       -moz-animation: slide 2s linear infinite;
            animation: slide 2s linear infinite;
}


@-webkit-keyframes slide
{
    0%   {background-position: 0 0;}
    100% {background-position: 100px 0;}
}​

@-moz-keyframes slide
{
    0%   {background-position: 0 0;}
    100% {background-position: 100px 0;}
}

@keyframes slide
{
    0%   {background-position: 0 0;}
    100% {background-position: 100px 0;}
}

like image 68
Zoltan Toth Avatar answered Sep 24 '22 23:09

Zoltan Toth