html5 canvas首屏自适应背景动画循环效果怎么插入
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html5 canvas首屏自适应背景动画循环效果怎么插入相关的知识,希望对你有一定的参考价值。
html5 canvas首屏自适应背景动画循环效果的插入方法:1、demo.html代码如下:
<html lang="en" class="no-js"><head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>html5 canvas首屏自适应背景动画循环效果代码</title>
<link rel="stylesheet" type="text/css" href="css/normalize.css">
<link rel="stylesheet" type="text/css" href="css/demo.css">
<!--必要样式-->
<link rel="stylesheet" type="text/css" href="css/component.css">
<!--[if IE]>
<script src="js/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="container demo-1">
<div class="content">
<div id="large-header" class="large-header" style="height: 185px;">
<canvas id="demo-canvas" width="1304" height="185"></canvas>
<h1 class="main-title">Connect <span class="thin">Three</span></h1>
</div>
<nav class="codrops-demos">
<a class="current-demo" href="index.html">Demo 1</a>
</nav>
</div>
</div><!-- /container -->
<script src="js/TweenLite.min.js"></script>
<script src="js/EasePack.min.js"></script>
<script src="js/rAF.js"></script>
<script src="js/demo-1.js"></script>
<div class="sogoutip" style="z-index: 2147483645; visibility: hidden; display: none;"></div><div class="sogoubottom" id="sougou_bottom" style="display: none;"></div><div id="ext_stophi" style="z-index: 2147483647;"><div class="extnoticebg"></div><div class="extnotice"><h2>关闭提示 <a href="#" title="关闭提示" id="closenotice" class="closenotice">关闭</a></h2><p id="sogouconfirmtxt"></p> <a id="sogouconfirm" href="#" class="extconfirm">确 认</a> <a id="sogoucancel" href="#" class="extconfirm">取 消</a></div></div><div id="ext_overlay" class="ext_overlayBG" style="display: none; z-index: 2147483646;"></div><iframe class="sogou_sugg_feedbackquan" frameborder="0" scrolling="no" src="http://ht.www.sogou.com/websearch/features/yun6.jsp?pid=sogou-brse-d2a452edff079ca6&w=1366&v=7400&st=1465483516429&od=6612&ls=1465482970132&lc=&lk=1463925952631&sd=72&cd=0&kd=0&u=1450532590172818&y=EC8B5B0919EDD514D2F1263AA4A58EF6&query=html5%20canvas%E9%A6%96%E5%B1%8F%E8%87%AA%E9%80%82%E5%BA%94%E8%83%8C%E6%99%AF%E5%8A%A8%E7%94%BB%E5%BE%AA%E7%8E%AF%E6%95%88%E6%9E%9C%E4%BB%A3%E7%A0%81|http%3A%2F%2Fwww.777moban.com%2FPreview%2F35_196%2Findex.html&r=http%3A%2F%2Fwww.777moban.com%2FPreview%2F35_196%2Findex2.html" style="border: none; display: none; z-index: 2147483645; background: transparent;"></iframe><script src="http://pb.sogou.com/pv.gif?hintbl=-1&uigs_productid=webext&type=ext_sugg&uigs_t=1465483517392<=212&ie=0&v=7400&y=EC8B5B0919EDD514D2F1263AA4A58EF6&query=html5%20canvas%E9%A6%96%E5%B1%8F%E8%87%AA%E9%80%82%E5%BA%94%E8%83%8C%E6%99%AF%E5%8A%A8%E7%94%BB%E5%BE%AA%E7%8E%AF%E6%95%88%E6%9E%9C%E4%BB%A3%E7%A0%81|http%3A%2F%2Fwww.777moban.com%2FPreview%2F35_196%2Findex.html"></script>
</body>
</html>
2、css样式如下:
article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summarydisplay:block;audio,canvas,videodisplay:inline-block;audio:not([controls])display:none;height:0;[hidden]display:none;htmlfont-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;bodymargin:0;a:focusoutline:thin dotted;a:active,a:hoveroutline:0;h1font-size:2em;margin:0.67em 0;abbr[title]border-bottom:1px dotted;b,strongfont-weight:bold;dfnfont-style:italic;hr-moz-box-sizing:content-box;box-sizing:content-box;height:0;markbackground:#ff0;color:#000;code,kbd,pre,sampfont-family:monospace,serif;font-size:1em;prewhite-space:pre-wrap;qquotes:"\201C" "\201D" "\2018" "\2019";smallfont-size:80%;sub,supfont-size:75%;line-height:0;position:relative;vertical-align:baseline;suptop:-0.5em;subbottom:-0.25em;imgborder:0;svg:not(:root)overflow:hidden;figuremargin:0;fieldsetborder:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em;legendborder:0;padding:0;button,input,select,textareafont-family:inherit;font-size:100%;margin:0;button,inputline-height:normal;button,selecttext-transform:none;button,html input[type="button"],input[type="reset"],input[type="submit"]-webkit-appearance:button;cursor:pointer;button[disabled],html input[disabled]cursor:default;input[type="checkbox"],input[type="radio"]box-sizing:border-box;padding:0;input[type="search"]-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration-webkit-appearance:none;button::-moz-focus-inner,input::-moz-focus-innerborder:0;padding:0;textareaoverflow:auto;vertical-align:top;tableborder-collapse:collapse;border-spacing:0; 参考技术A
以demo为例
<!--必要样式--><link rel="stylesheet" type="text/css" href="css/component.css" />
<!--[if IE]>
<script src="js/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="container demo-4">
<div class="content">
<div id="large-header" class="large-header">
<canvas id="demo-canvas"></canvas>
<h1 class="main-title">Morning Light</span></h1>
</div>
<nav class="codrops-demos">
<a href="index.html">Demo 1</a>
<a href="index2.html">Demo 2</a>
<a href="index3.html">Demo 3</a>
<a class="current-demo" href="index4.html">Demo 4</a>
</nav>
</div>
</div><!-- /container -->
<script src="js/rAF.js"></script>
<script src="js/demo-4.js"></script>
只要有必要的CSS样式文件 和相应的div再有JS文件就可以了
123456789101112131415161718192021222324<!--必要样式--><link rel="stylesheet" type="text/css" href="css/component.css" /> <!--[if IE]> <script src="js/html5.js"></script><![endif]--></head><body><div class="container demo-4"> <div class="content"> <div id="large-header" class="large-header"> <canvas id="demo-canvas"></canvas> <h1 class="main-title">Morning Light</span></h1> </div> <nav class="codrops-demos"> <a href="index.html">Demo 1</a> <a href="index2.html">Demo 2</a> <a href="index3.html">Demo 3</a> <a class="current-demo" href="index4.html">Demo 4</a> </nav> </div></div><!-- /container --><script src="js/rAF.js"></script><script src="js/demo-4.js"></script>
只要有必要的CSS样式文件 和相应的div再有JS文件就可以了 参考技术C 可不可以具体点?
以上是关于html5 canvas首屏自适应背景动画循环效果怎么插入的主要内容,如果未能解决你的问题,请参考以下文章