I did a long time of moving animation and it's lagging and moving.

Asked 2 years ago, Updated 2 years ago, 40 views

It repeats moving one box of images up and down 150 pixels each for a total of 80 seconds It doesn't move smoothly, but it keeps breaking off. What can I do?

.imgBox img{

    position:absolute;
    top:0px;
    -webkit-animation: listImg 80s linear infinite;
                    animation: listImg 80s linear infinite;
}

@-webkit-keyframes listImg{

    50%{top:-150px;}
    100%{top:0px;}
}

@keyframes listImg{

    50%{top:-150px;}
    100%{top:0px;}
}

It's a code.

css jquery

2022-09-22 20:36

1 Answers

Oh, that's right It's been a while since I touched this side, so Shin Chan doesn't work well. Phew... Maybe because I'm getting older...

You can do it like below.

.imgBox img{
    position:absolute;
    transform: translate(0, 0);
    animation: listImg 80s linear infinite;
}
@keyframes listImg{
    50%{transform: translate(0, -150px);}
    100%{transform: translate(0, 0);}
}


2022-09-22 20:36

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.