DEV Community

Cover image for [Sass]: Simple dot animation
Anastasiia_Berest
Anastasiia_Berest

Posted on

[Sass]: Simple dot animation

And I found my old pet project when I was interested in Sass. Well, this looks not very organic or rhythmic, not Brownian motion.

Pug:

- for (var x = 0; x < 11; x++)
  div.b
Enter fullscreen mode Exit fullscreen mode

Sass:

.b
  width: 10vmin
  height: 10vmin
  border-radius: 50%
  position: absolute
  top: 0
  left: 0
  animation-iteration-count: infinite 
  animation-direction: alternate
  animation-timing-function: linear
  animation-fill-mode: backwards
@for $i from 1 through 15
  @keyframes anm#{$i}
    0% 
      left: 10vmin
      top: 10vmin
      opacity: 0
    100%
      left: random(250)+vmin
      top: random(250)+vmin
      transform: scale(random(3))
  .b:nth-child(#{$i})
    animation-name: anm#{$i}
    animation-duration: random(20)+s
    animation-delay: $i/10 +s 
    background: linear-gradient(45deg, rgb(random(255), random(255), random(255)), rgb(random(255), random(255), random(255)))
Enter fullscreen mode Exit fullscreen mode

codepen_ex

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay