Nu skal vi ned i CSS’en og lave styling på body og de div boksen detHele.
body {
background-color: black;
}
.detHele {
margin-left: 20%;
margin-top: 5%;
border-radius: 50%;
border: 2px solid white;
height: 450px;
width: 450px;
padding-right: 50px;
cursor: pointer;
box-shadow: -3px -5px 80px 30px green;
-webkit-box-reflect: below 1px linear-gradient(transparent, #0005);
}
Læg mærke til at vi benytter en -webkit-box-reflect. Denne skal vi bruge for at reflektere vores cirkel nedenunder sig selv(below)
Nu skal vi lave vores animation af skyggen/gløden på cirklen.
.detHele:hover {
animation: rainbow1 10s infinite linear;
}
@keyframes rainbow1 {
0% {box-shadow: -3px -5px 80px 30px green;}
20% {box-shadow: -3px -5px 80px 30px yellow;}
40% {box-shadow: -3px -5px 80px 30px orange;}
60% {box-shadow: -3px -5px 80px 30px red;}
80% {box-shadow: -3px -5px 80px 30px purple;}
95% {box-shadow: -3px -5px 80px 30px blue;}
100% {box-shadow: -3px -5px 80px 30px green;}
}
Vi vil gerne at når man holder musen over(hover) så skifter det farve.
.hover1 {
position: absolute;
margin-left: 100px;
margin-top: 200px;
font-size: 40px;
font-family: verdana;
color: black;
background-color: white;
height: 50px;
width: 300px;
text-align: center;
border-radius: 50px;
}
.detHele:hover > .hover1 {
opacity: 0;
}
Ved at bruge > kan vi sige at når vi rører ved den store cirkel(detHele) så skal den indeni(>) animere den div der heder hover1
Inde i url(” “), genbruger vi linket fra sneopgaven:
https://mom2day.dk/wp-content/uploads/2020/12/snowflakeBG1GIF.gif
.detHele:hover > .oval1 {
position: absolute;
height: 50px;
width: 50px;
border: 2px solid white;
border-radius: 50%;
margin-left: 225px;
margin-top: 175px;
transform: rotate(60deg);
animation: stretch1 2s infinite linear;
}
@keyframes stretch1 {
0% {
margin-left: 275px; margin-top: 175px;
height: 50px; width: 50;
border: 2px solid green;
}
80% {
margin-left: 375px; margin-top: 0px;
height: 300px; width: 50px;
opacity: 1; border: 2px solid orange;
}
100% {
margin-left: 375px; margin-top: 0px;
height: 300px; width: 50px;
opacity: 0;
}
}
.detHele:hover > .oval2 {
position: absolute;
height: 50px;
width: 50px;
border: 2px solid white;
border-radius: 50%;
margin-left: 225px;
margin-top: 175px;
transform: rotate(135deg);
animation: stretch2 2s infinite linear;
}
@keyframes stretch2 {
0% {
margin-left: 250px; margin-top: 225px;
height: 50px; width: 50;
border: 2px solid green;
}
80% {
margin-left: 350px; margin-top: 200px;
height: 300px; width: 50px;
opacity: 1; border: 2px solid orange;
}
100% {
margin-left: 350px; margin-top: 200px;
height: 300px; width: 50px;
opacity: 0;
}
}
.detHele:hover > .oval3 {
position: absolute;
height: 50px;
width: 50px;
border: 2px solid white;
border-radius: 50%;
margin-left: 225px;
margin-top: 175px;
transform: rotate(180deg);
animation: stretch3 2s infinite linear;
}
@keyframes stretch3 {
0% {
margin-left: 225px; margin-top: 275px;
height: 50px; width: 50;
border: 2px solid green;
}
80% {
margin-left: 225px; margin-top: 250px;
height: 300px; width: 50px;
opacity: 1; border: 2px solid orange;
}
100% {
margin-left: 225px; margin-top: 250px;
height: 300px; width: 50px;
opacity: 0;
}
}
.detHele:hover > .oval4 {
position: absolute;
height: 50px;
width: 50px;
border: 2px solid white;
border-radius: 50%;
margin-left: 225px;
margin-top: 175px;
transform: rotate(225deg);
animation: stretch4 2s infinite linear;
}
@keyframes stretch4 {
0% {
margin-left: 200px; margin-top: 225px;
height: 50px; width: 50;
border: 2px solid green;
}
80% {
margin-left: 100px; margin-top: 200px;
height: 300px; width: 50px;
opacity: 1; border: 2px solid orange;
}
100% {
margin-left: 100px; margin-top: 200px;
height: 300px; width: 50px;
opacity: 0;
}
}
.detHele:hover > .oval5 {
position: absolute;
height: 50px;
width: 50px;
border: 2px solid white;
border-radius: 50%;
margin-left: 225px;
margin-top: 175px;
transform: rotate(300deg);
animation: stretch5 2s infinite linear;
}
@keyframes stretch5 {
0% {
margin-left: 190px; margin-top: 175px;
height: 50px; width: 50;
border: 2px solid green;
}
80% {
margin-left: 80px; margin-top: 0px;
height: 300px; width: 50px;
opacity: 1;
}
100% {
margin-left: 80px; margin-top: 0px;
height: 300px; width: 50px;
opacity: 0; border: 2px solid orange;
}
}
.detHele:hover > .oval6 {
position: absolute;
height: 50px;
width: 50px;
border: 2px solid white;
border-radius: 50%;
margin-left: 225px;
margin-top: 175px;
transform: rotate(180deg);
animation: stretch6 2s infinite linear;
}
@keyframes stretch6 {
0% {
margin-left: 225px; margin-top: 125px;
height: 50px; width: 50;
border: 2px solid green;
}
80% {
margin-left: 225px; margin-top: -75px;
height: 300px; width: 50px;
opacity: 1; border: 2px solid orange;
}
100% {
margin-left: 225px; margin-top: -75px;
height: 300px; width: 50px;
opacity: 0;
}
}
.detHele:hover > .midt1 {
position: absolute;
height: 50px;
width: 50px;
border: 2px solid white;
border-radius: 50%;
margin-left: 225px;
margin-top: 210px;
background-color: white;
box-shadow: -3px -5px 50px 15px pink;
animation: bloom1 2s infinite linear;
}
@keyframes bloom1 {
from {
margin-left: 225px; margin-top: 200px;
transform: scale(0%,0%)
}
to {
margin-left: 225px; margin-top: 210px;
transform: scale(100%,100%)
}
}