Create a loop using SCSS to change background images with CSS3 animate?

独自空忆成欢 提交于 2019-12-02 10:07:03
cimmanon

Sass can only increment (or decrement) @for loops by 1. If you want a different interval, you need to use math to get there:

@-webkit-keyframes perimeter {
  @for $i from 0 through 39 {
    #{$i * 2.564102564102564%} {
      background-image: url('../img/perimeters/PerimeterFountains#{$i}.png');
    }
  }
}

Related: Rounding numbers in Sass and adjusting the amount of decimals

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!