0%

wipe

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!-- html --> 
<div class="scenes" tabindex="0">
<div class="scene-1">
<h2 class="scene-title">北京鸟巢</h2>
</div>
<div class="scene-2">
<h2 class="scene-title">鸟巢夜景</h2>
</div>
</div>

<div class="visualizer">
<div class="visualizer-frame">
<div class="visualizer-mask"></div>
</div>
</div>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

.scenes {
position: relative;
height: 416px;
outline: 2px solid #ccc;
}

.scene-1,
.scene-2 {
position: absolute;
inset: 0;
background-size: cover;
}

.scene-1 {
background-image: url(1.jpg);
}

.scene-2 {
background-image: url(2.jpg);
-webkit-mask-image: linear-gradient(to right, transparent 47.5%, #fff 52.5%);
-webkit-mask-size: 210%;
-webkit-mask-position: left;
}
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
.scenes:is(:hover, :focus) .scene-2 {
-webkit-mask-position: right;
transition: -webkit-mask-position 2s linear;
}

.scene-title {
position: absolute;
max-width: 45%;
margin: min(40px, 4vw);
font-size: 1.25em;
}

.scene-1 .scene-title {
top: 0;
left: 0;
color: #000;
text-align: left;
}

.scene-2 .scene-title {
top: 0;
right: 0;
color: #fff;
text-align: right;
}