javascript - How to realize this dot animation using CSS or JS? - Stack Overflow

This GIF es from dribbble.I've tried to write a demo with pure CSS, here's part of my codes:@k

This GIF es from dribbble.

I've tried to write a demo with pure CSS, here's part of my codes:

@keyframes circles{
  0%{
    transform: scale(0) rotate(150deg);
  }
  100%{
    transform: scale(1) rotate(0deg);
  }
}

They won't rotate as a whole.

The mixing animation at the center of the gif is not required, I just want to realize the rotating effect.

Hope someone can help me.

This GIF es from dribbble.

I've tried to write a demo with pure CSS, here's part of my codes:

@keyframes circles{
  0%{
    transform: scale(0) rotate(150deg);
  }
  100%{
    transform: scale(1) rotate(0deg);
  }
}

They won't rotate as a whole.

The mixing animation at the center of the gif is not required, I just want to realize the rotating effect.

Hope someone can help me.

Share Improve this question asked Jul 8, 2016 at 4:06 Jc.Jc. 2141 silver badge9 bronze badges 2
  • I don't know if that means anything to you, but I like yours better. – Angel Politis Commented Jul 8, 2016 at 4:11
  • @AngelPolitis I want them to rotate from the center as a whole. – Jc. Commented Jul 8, 2016 at 4:15
Add a ment  | 

2 Answers 2

Reset to default 5

This is a pound or nested movement. The break down is:

  • The dots themselves are just sliding along a straight line inwards and scaling a little bit as they travel
  • Each dot's start time is offset slightly from the last so they appear to travel in sequence, which gives the illusion of a swirl.
  • Finally, the dots would all be grouped under a parent element who's only job is to rotate.

Following this approach, you can easily apply simple translation and rotation animations to each element and still get this swirling effect.

This is a bit late, but here is my jsfiddle following @Soviut's answer

https://jsfiddle/hfpymtba/

The 'spin' animation is applied to the container

@keyframes spin{
  0%{
    transform: rotate(0deg);
  }
  100%{
    transform: rotate(360deg);
  }
}

The 'graviton' animation is applied to the circle classes

@keyframes graviton{
  100%{
    top:50%;
    left:50%;
  }
}

There is a bit of wobble as the circles aren't perfectly around the centre of the container.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745512660a4630840.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信