janvas实现canvas华为鸿蒙操作系统开机动画效果代码
代码语言:html
所属分类:动画
代码描述:janvas实现canvas华为鸿蒙操作系统开机动画效果代码
代码标签: janvas canvas 华为 鸿蒙 操作系统 开机 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body{
background: black;
}
</style>
</head>
<body >
<div id="app"></div>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/janvas.js"></script>
<script >
new janvas.Canvas({
container: "#app",
duration: 4000,
width: 800,
height: 400,
props: {
leftText: "Harmony",
centerText: "O",
rightText: "S"
},
methods: {
init: function () {
var ctx = this.$ctx, w = this.$width, h = this.$height,
font = w / 2 + "px sans-serif", blur = w / 10;
this.bg = new janvas.Rect(ctx, 0, 0, w, h);
this.top = new janvas.Rect(ctx, 0, 0, w, h / 2);
this.bottom = new janvas.Rect(ctx, 0, h / 2, w, h / 2);
this.centerTop = this._getText(w / 2, h / 2, this.centerText, font, "center", blur);
var offsetY = h / 2 - (this.centerTop.getTop() + this.centerTop.getBottom()) / 2,
startY = h / 2 + offsetY;
this.centerTop.setStartY(startY);
this.centerBottom = this._getText(w / 2, startY, this.centerText, font, "center", blur);
var centerWidth = this.centerTop.getWidth();
this.centerTop.getMatrix().setOffsetY(centerWidth / 2);
this.centerBottom.getMatrix().setOffsetY(-centerWidth / 2);
this.left = this._getText(w / 2 - centerWidth / 2, startY, this.leftText, font, "right");
this.right = this._getText(w / 2 + centerWidth / 2, startY, this.rightText, font,.........完整代码请登录后点击上方下载按钮下载查看
网友评论0