利用图片播放

<div class="wrap" id="wrap" style="position: inherit; height: 604px;">
<div class="main">
<script src="http://www.zaidu.sn.cn/zaidu/刺激战场争霸赛3/js/canvas.js"></script>
<div id="loading" class="compatibleStyle">
<div id="startPlay" style="display: none">开始刺激时刻</div>
<canvas id="clgass" width="128" height="128"></canvas>
<script>
var frame_Imgs_1=['run_1.png','run_2.png','run_3.png','run_4.png','run_5.png','run_6.png','run_7.png','run_8.png','run_9.png','run_10.png','run_11.png','run_12.png','run_13.png','run_14.png','run_15.png','run_16.png',]; //新建动画实例
var cfa1=new canvasfa({
cav:'clgass'//canvas画布id
,frames:frame_Imgs_1//帧动画的素材
,url:'http://www.zaidu.sn.cn/demo/zaidu_03/img/'//图片路径
,fps:24//【可选参数】每秒帧数,默认每秒15帧。(液晶屏每秒刷新60次,所以帧数最好是可以整除60的数)
,loop:true//【可选参数】循环播放,false则单次播放并停留在最后一帧,true和默认是循环播放
//,autoplay:false//【可选参数】素材加载完毕后是否自动播放; false不播放,true和默认是自动播放。可用 实例对象.start()手动开启播放
//,loading_done:alert1//【可选参数】参数需要是一个函数,在素材加载完毕后运行。可缺省此参数。 }); //开始
var _PageHeight = document.documentElement.clientHeight,
_PageWidth = document.documentElement.clientWidth;
//计算loading框距离顶部和左部的距离(loading框的宽度为215px,高度为61px)
var _LoadingTop = _PageHeight > 61 ? (_PageHeight - 61) / 2 : 0,
_LoadingLeft = _PageWidth > 215 ? (_PageWidth - 215) / 2 : 0;
//在页面未加载完毕之前显示的loading Html自定义内容
var _LoadingHtml = document.getElementById("clgass");
//呈现loading效果 /*'<div id="loadingDiv" style="position:absolute;left:0;width:100%;height:' + _PageHeight + 'px;top:0;background:#f3f8ff;opacity:1;filter:alpha(opacity=80);z-index:10000;"><div style="position: absolute; cursor1: wait; left: ' + _LoadingLeft + 'px; top:' + _LoadingTop + 'px; width: auto; height: 57px; line-height: 57px; padding-left: 50px; padding-right: 5px; background: #fff url(Image/loading.gif) no-repeat scroll 5px 10px; border: 2px solid #95B8E7; color: #696969; font-family:\'Microsoft YaHei\';">页面加载中,请等待...</div></div>'*/ document.write(_LoadingHtml); //window.onload = function () {
// var loadingMask = document.getElementById('loadingDiv');
// loadingMask.parentNode.removeChild(loadingMask);
//}; //监听加载状态改变
document.onreadystatechange = completeLoading; //加载状态为complete时移除loading效果
function completeLoading() {
if (document.readyState == "complete") {
var loadingMask = document.getElementById('loading');
loadingMask.parentNode.removeChild(loadingMask);
}
}
</script>
</div>
05-02 18:17