I am trying to implement image transition in slide show. I have 4 rectangular boxes fit in a div container. Each box need to disappear the part that is coming into another box area after intersecting with another box as they move. At 100%, each box need to disappear completely.
@keyframes testAnimateOne {
0% {
transform: rotate(0);
transform-origin: bottom right;
opacity: 1;
}
100% {
transform-origin: bottom right;
transform: rotate(90deg);
}
}
@keyframes testAnimateTwo {
0% {
transform: rotate(0);
transform-origin: top right;
opacity: 1;
}
100% {
transform-origin: top right;
transform: rotate(-90deg);
}
}
@keyframes testAnimateThree {
0% {
transform: rotate(0);
transform-origin: bottom left;
opacity: 1;
}
100% {
transform-origin: bottom left;
transform: rotate(-90deg);
}
}
@keyframes testAnimateFour {
0% {
transform-origin: top left;
transform: rotate(0);
opacity: 1;
}
100% {
transform-origin: top left;
transform: rotate(90deg);
}
}
.layer1 {
width:50%;
height: 43px;
position: absolute;
background-color: black;
animation-name: testAnimateOne;
animation-duration: 5s;
}
.layer2 {
margin-top: 30%;
width: 50%;
height: 43px;
position: absolute;
background-color:black;
animation-name: testAnimateTwo;
animation-duration: 5s;
}
.layer3 {
width: 50%;
height: 50%;
margin-left: 50%;
position: absolute;
background-color: black;
animation-name: testAnimateThree;
animation-duration: 5s;
}
.layer4 {
margin-top: 30%;
margin-left: 50%;
width: 50%;
height: 50%;
position: absolute;
background-color: black;
animation-name: testAnimateFour;
animation-duration: 5s;
}
.container {
width: 140px;
height: 86px;
position: relative;
display: block;
}
<div class="container">
<div class="layer1"></div>
<div class="layer2"></div>
<div class="layer3"></div>
<div class="layer4"></div>
</div>
How is that possible? please help