"Image reveal animation"
Bootstrap 4.1.1 Snippet by ALIMUL AL RAZY

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<button id="action" class="btn btn-primary">Click</button>
<div class="stage">
<div id="background"></div>
<svg id="demo" xmlns="http://www.w3.org/2000/svg" width="2000" height="2000" viewBox="0 0 1000 1000">
<defs>
<clipPath id="theClipPath">
<rect id="clipper" x="0" y="0" width="1000" height="1000" fill="#333" />
</clipPath>
</defs>
<g id="clipPathReveal" clip-path="url(#theClipPath)">
<image xlink:href="https://cdn.pixabay.com/photo/2021/11/18/22/17/butterfly-6807529_640.jpg" x="0" y="0" width="100%" height="100%" />
</g>
</svg>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.1.2/TweenMax.min.js"></script>
<script>
console.clear();
var tl = new TimelineMax();
TweenMax.set(".stage", { opacity: 1 });
tl.from("#background", 1, { xPercent: -100 });
tl.from("#clipper", 1, { width: 0 }, 0.5);
tl.reversed(true);
document.querySelector("#action").addEventListener("click", doCoolStuff);
function doCoolStuff() {
tl.reversed(!tl.reversed());
}
</script>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
* {
box-sizing: border-box;
}
body {
height: 100vh;
width: 100%;
padding: 0;
margin: 0;
overflow: hidden;
background: #000;
color: white;
font-family: "Roboto", sans-serif;
}
.stage {
display: flex;
align-content: center;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
width: 100%;
position: relative;
z-index: 1;
opacity: 0;
}
#demo {
width: auto;
height: auto;
max-height: 80%;
max-width: 80%;
posiion: relative;
z-index: 20;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: