城市漫游特效
代码语言:html
所属分类:背景
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Procedural Canvas cityscape (profile header)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
background: black;
margin: 0;
padding: 0;
overflow: hidden;
}
canvas {
background: transparent;
background-image: linear-gradient(black 20%, #101 30%, #211 40%, #070702 52%, #000 90%, #000 100%);
background-repeat: no-repeat;
display: block;
margin: 0 auto;
width: 100%;
max-width: 1800px;
height: 300px;
}
#vignette {
background-image: linear-gradient(right, black 0%, transparent 10%, transparent 90%, black 100%);
position: absolute;
top: 0;
left: 50%;
width: 100%;
height: 300px;
max-width: 1800px;
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
z-index: 50;
}
</style>
</head>
<body translate="no">
<script>
// OVERENGINEERED UNOPTIMIZED CANVAS BULLSH*T
// BUT IT'S OKAY SINCE IT'S BLADE RUNNER INNIT
// Some stuff left unoptimized / verbose to show the work.
// TODO:
// - optimize render loop, avoid overdraws, etc
// - smoothly fade rows in on the horizon
// Constants. Change at own risk
const CANVAS_WIDTH = 900;
const CANVAS_HEIGHT = 300;
const FRAME.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0