zdog实现可拖拽三维旋转的卡通人物精灵面对面效果代码

代码语言:html

所属分类:三维

代码描述:zdog实现可拖拽三维旋转的卡通人物精灵面对面效果代码

代码标签: zdog 拖拽 三维 旋转 卡通 人物 精灵 面对面

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
<style>
html {
	height:100%
}
body {
	min-height:100%;
	margin:0;
	display:flex;
	align-items:center;
	justify-content:center;
	background:#435;
	color:white;
	font-family:sans-serif;
	text-align:center
}
canvas {
	display:block;
	margin:0 auto;
	cursor:move
}

</style>
</head>

<body>

    <div class="container"><canvas class="illo"></canvas>
        <p>拖拽旋转</p>
    </div>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/zdog.dist.js"></script>
    <script>
  

var BokehShape = Zdog.Shape.subclass({
    bokehSize: 5,
    bokehLimit: 64,
});
BokehShape.prototype.updateBokeh = function() {
    this.bokeh = Math.abs(this.sortValue) / this.bokehLimit;
    this.bokeh = Math.max(0, Math.min(1, this.bokeh));
    return this.bokeh
};
BokehShape.prototype.getLineWidth = function() {
    return this.stroke + this.bokehSize * this.bokeh * this.bokeh
};
BokehShape.prototype.getBokehAlpha = function() {
    var a = 1 - this.bokeh;
    a *= a;
    return a * 0.8 + 0.2
};
BokehShape.prototype.renderCanvasDot = function(a) {
    this.updateBokeh();
    a.globalAlpha = this.getBokehAlpha();
    Zdog.Shape.prototype.renderCanvasDot.apply(this, arguments);
    a.globalAlpha = 1
};
BokehShape.prototype.renderPath = function(a, b) {
    this.updateBokeh();
    if (b.isCanvas) {
        a.globalAlpha = this.getBokehAlpha()
    }
    Zdog.Shape.prototype.renderPath.apply(this, arguments);
    if (b.isCanvas) {
        a.globalAlpha = 1
    }
};
var TAU = Zdog.TAU;

function makeMadeli.........完整代码请登录后点击上方下载按钮下载查看

网友评论0