Cookie Consent by Free Privacy Policy Generator ๐Ÿ“Œ CSS Animation: A circle with smaller circles orbiting it.

๐Ÿ  Team IT Security News

TSecurity.de ist eine Online-Plattform, die sich auf die Bereitstellung von Informationen,alle 15 Minuten neuste Nachrichten, Bildungsressourcen und Dienstleistungen rund um das Thema IT-Sicherheit spezialisiert hat.
Ob es sich um aktuelle Nachrichten, Fachartikel, Blogbeitrรคge, Webinare, Tutorials, oder Tipps & Tricks handelt, TSecurity.de bietet seinen Nutzern einen umfassenden รœberblick รผber die wichtigsten Aspekte der IT-Sicherheit in einer sich stรคndig verรคndernden digitalen Welt.

16.12.2023 - TIP: Wer den Cookie Consent Banner akzeptiert, kann z.B. von Englisch nach Deutsch รผbersetzen, erst Englisch auswรคhlen dann wieder Deutsch!

Google Android Playstore Download Button fรผr Team IT Security



๐Ÿ“š CSS Animation: A circle with smaller circles orbiting it.


๐Ÿ’ก Newskategorie: Programmierung
๐Ÿ”— Quelle: dev.to

Here is what we will be making

Starting with the HTML

  1. We create a container .container which centers all other content
  2. Another container .hero-circle that contains the content
  3. Add img inside .hero-circle
  4. Created another container .hero-rotate inside .hero-circle
  5. Lastly we add 4 divs .planet inside .hero-rotate each container an img

HTML

<div class="container">
  <div class="hero-circle">
    <img class="inner-img"
      src="https://images.unsplash.com/photo-1465414829459-d228b58caf6e?ixlib=rb-0.3.5&q=80&auto=format&crop=entropy&cs=tinysrgb&w=600&h=338&fit=crop&s=7ab1744fe016fb39feb2972244246359"
      alt="" />
    <div class="hero-rotate" id="circle">
      <div class="planet">
        <img
          src="https://images.unsplash.com/photo-1465414829459-d228b58caf6e?ixlib=rb-0.3.5&q=80&auto=format&crop=entropy&cs=tinysrgb&w=600&h=338&fit=crop&s=7ab1744fe016fb39feb2972244246359"
          alt="" />
      </div>
      <div class="planet">
        <img
          src="https://images.unsplash.com/uploads/1413142095961484763cf/d141726c?ixlib=rb-0.3.5&q=80&auto=format&crop=entropy&cs=tinysrgb&w=600&h=338&fit=crop&s=86dc2dcb74588b338dfbb15d959c5037"
          } alt="" />
      </div>
      <div class="planet">
        <img
          src="https://images.unsplash.com/photo-1484402628941-0bb40fc029e7?ixlib=rb-0.3.5&q=80&auto=format&crop=entropy&cs=tinysrgb&w=600&h=338&fit=crop&s=6237e62a10fa079d99b088b0db0144ac"
          alt="" />
      </div>
      <div class="planet">
        <img
          src="https://images.unsplash.com/uploads/141310026617203b5980d/c86b8baa?ixlib=rb-0.3.5&q=80&auto=format&crop=entropy&cs=tinysrgb&w=600&h=338&fit=crop&s=882e851a008e83b7a80d05bdc96aa817"
          alt="" />
      </div>
    </div>
  </div>
</div>

Now The CSS

Our outermost div (.container) is covers the entire screen and centers .hero-circle. We'll also add custom properties for the diameter(width and height) of the .hero-circle and the diameter of .planet. This way all we need to do is change the value of those custom properties to make it responsive on small screens

.container {
    display: grid;
    width
    height:100vh;
    place-items: center;
    overflow: hidden;
    background-color: black;
    --circleDiameter: 300px;
    --planets: calc(var(--circleDiameter) / 5)
}

Now we set the width and height of our content container .hero-circle to the --circleDiameter custom property

.hero-circle {
    position:relative;
    width: var(--circleDiameter);
    height: var(--circleDiameter)
}

What's next is to place the center image at the center of .hero-circle

.inner-img {
  position:absolute;
  top:50%;
  left:50%;
  transform: translate(-50%,-50%);
  border-radius:10px;
  width:90px;
  height:90px;
}

that's one way to center a div ๐Ÿ˜‰

We then create the big circle .hero-rotate

.hero-rotate {
    position: relative;
    top: -7px;
    left:-7px;
    width: 100%;
    height: 100%;
    border: 7px solid white;
    border-radius: 100%;
    animation: rotate 30s linear infinite;
}

We'll add the animation later

Add styles to .planets and the image inside each planet

.planet {
    position: absolute;
    width: var(--planets);
    height: var(--planets);
    border-radius: 100%;
    animation: maintain 30s linear infinite;
}

.planet>img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 5px solid white;
    box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    animation: scale 1s linear infinite alternate; 
}

At this point we haven't added the animations yet and we should have something like this.

You only see one image on the circle because they are stacked on each other.

To place the .planets evenly around the bigger circle .hero-rotate, we'll be using the --planets custom property to calculate where to place each circle for responsiveness.
Since there are four .planets we would place them top-center, left-center, bottom-center and right-center

Image description

place .planets

.planet:nth-child(1) {
    top: calc(-1 * var(--planets) / 2);
    left: calc(var(--circleDiameter)/ 2 - var(--planets) / 2)
}

.planet:nth-child(2) {
    top: calc(var(--circleDiameter)/ 2 - var(--planets) / 2);
    right: calc(-1 * var(--planets) / 2);
}

.planet:nth-child(3) {
    top: calc(var(--circleDiameter)/ 2 - var(--planets) / 2);
    left: calc(-1 * var(--planets) / 2);
}

.planet:nth-child(4) {
    left: calc(var(--circleDiameter)/ 2 - var(--planets) / 2 );
    bottom: calc(-1 * var(--planets) / 2);
}

You can adjust the position as you like

Animations

Animations are simple.
First we rotate the outer circle .hero-rotate which will make it seem like it's the .planets that are moving
the rotate animation

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


From the above preview we could see that the images are turning over because of the rotatoin and we don't that.
To solve that we simply make .planet rotate in the opposite direction and also add scale animation to the images

@keyframes maintain {
    0% {
        transform: rotate(0);
    }

    100% {
        transform: rotate(-360deg);
    }
}

@keyframes scale {
    0% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

The final out put

That's it, if anything is unclear, ask in the comments and I'll explain further.

ciao

...



๐Ÿ“Œ CSS Animation: A circle with smaller circles orbiting it.


๐Ÿ“ˆ 101.61 Punkte

๐Ÿ“Œ Animation -13 : Simple Content Preload CSS Animation


๐Ÿ“ˆ 37.51 Punkte

๐Ÿ“Œ Animation -18 : Pure CSS Gooey Loader Animation


๐Ÿ“ˆ 37.51 Punkte

๐Ÿ“Œ Animation -19 : Simple preloader CSS Animation


๐Ÿ“ˆ 37.51 Punkte

๐Ÿ“Œ Animation -22 : Cube Flipping Loader CSS Animation


๐Ÿ“ˆ 37.51 Punkte

๐Ÿ“Œ The smaller the business, the smaller the focus on cybersecurity


๐Ÿ“ˆ 30.13 Punkte

๐Ÿ“Œ Googleโ€™s Circle to Search may soon arrive on Microsoft Edge. Itโ€™s called โ€œCircle to Copilotโ€


๐Ÿ“ˆ 29.39 Punkte

๐Ÿ“Œ Microsoft Edge on iOS tests โ€œCircle to Copilotโ€, similar to Googleโ€™s Circle to Search


๐Ÿ“ˆ 29.39 Punkte

๐Ÿ“Œ CSS Grid: Moving From CSS Frameworks To CSS Grid (2018 and beyond)


๐Ÿ“ˆ 28.39 Punkte

๐Ÿ“Œ Stylify CSS: Automagic CSS bundles splitting into CSS layers in Astro.build


๐Ÿ“ˆ 28.39 Punkte

๐Ÿ“Œ Choosing the Right CSS Approach: Tailwind CSS vs Bootstrap vs Vanillaย CSS


๐Ÿ“ˆ 28.39 Punkte

๐Ÿ“Œ A BRIEF REVIEW OF CSS CASCADING, CSS SELECTORS and CSS SPECIFICITY.


๐Ÿ“ˆ 28.39 Punkte

๐Ÿ“Œ Pencil2D Animation - Opensource animation software


๐Ÿ“ˆ 28.05 Punkte

๐Ÿ“Œ Animation -17 : Staggered Stair Loading Animation


๐Ÿ“ˆ 28.05 Punkte

๐Ÿ“Œ Rendering( or How to Render) Animation in JSON format with LottieFiles animation in React application


๐Ÿ“ˆ 28.05 Punkte

๐Ÿ“Œ Specify how multiple animation effects should composite with `animation-composition`


๐Ÿ“ˆ 28.05 Punkte

๐Ÿ“Œ Forscher meldet kritische Sicherheitslรผcke in Silent Circles Blackphone


๐Ÿ“ˆ 24.48 Punkte

๐Ÿ“Œ Forscher meldet kritische Sicherheitslรผcke in Silent Circles Blackphone


๐Ÿ“ˆ 24.48 Punkte

๐Ÿ“Œ Nine circles of Cerber


๐Ÿ“ˆ 24.48 Punkte

๐Ÿ“Œ VB2017 paper: Nine circles of Cerber


๐Ÿ“ˆ 24.48 Punkte

๐Ÿ“Œ MMD-0055-2016 - Linux/PnScan ; ELF worm that still circles around


๐Ÿ“ˆ 24.48 Punkte

๐Ÿ“Œ Mit Twitter Circles Nachrichten an einen ausgewรคhlten Kreis verschicken


๐Ÿ“ˆ 24.48 Punkte

๐Ÿ“Œ Count the number of circles at edges


๐Ÿ“ˆ 24.48 Punkte

๐Ÿ“Œ Smashing Security podcast #321: Eurovision, acts of war, and Twitter circles


๐Ÿ“ˆ 24.48 Punkte

๐Ÿ“Œ Get Rid Of The Circles And Get The Old Twitter Interface Back


๐Ÿ“ˆ 24.48 Punkte

๐Ÿ“Œ Get Rid Of The Circles And Get The Old Twitter Interface Back


๐Ÿ“ˆ 24.48 Punkte

๐Ÿ“Œ A US Spy Plane Has Been Flying Circles Over Seattle For Days


๐Ÿ“ˆ 24.48 Punkte

๐Ÿ“Œ Alleged Russian operative infiltrated DC circles, studied US cyber strategies


๐Ÿ“ˆ 24.48 Punkte

๐Ÿ“Œ Ghost Ships, Crop Circles, and Soft Gold: A GPS Mystery in Shanghai


๐Ÿ“ˆ 24.48 Punkte

๐Ÿ“Œ Ghost ships, crop circles, and soft gold: A GPS mystery in Shanghai


๐Ÿ“ˆ 24.48 Punkte

๐Ÿ“Œ How to install the Simply Circles icon theme on Linux


๐Ÿ“ˆ 24.48 Punkte

๐Ÿ“Œ How to install the Simply Circles icon theme on Linux


๐Ÿ“ˆ 24.48 Punkte

๐Ÿ“Œ Crop Circles - and Why People Believed in Them


๐Ÿ“ˆ 24.48 Punkte

๐Ÿ“Œ From hierarchies to circles: An evolution of work habits


๐Ÿ“ˆ 24.48 Punkte

๐Ÿ“Œ Twitter admits to โ€˜security incidentโ€™ involving Circles tweets


๐Ÿ“ˆ 24.48 Punkte











matomo