<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSS3模拟透过脏玻璃(窗户)看室外景色</title>
<style>
body {
margin: 0;
}
.wasteland {
animation: zoomIn 10s linear infinite alternate;
background-image: url(img/wasteland.jpg);
background-size: cover;
height: 100vh;
position: fixed;
width: 100vw;
}
.glass {
animation: zoomIn 10s linear infinite alternate-reverse;
background-image: url(img/dirty-glass.jpg);
background-size: cover;
height: 100vh;
opacity: .3;
position: fixed;
width: 100vw;
}
@keyframes zoomIn {
0% {
transform: scale(1);
}
100% {
transform: scale(1.5);
}
}
</style>
</head>
<body>
<div class="wasteland"></div>
<div class="glass"></div>
</body>
</html>