lightningJs实现一个数字时分秒当前时间动画效果代码
代码语言:html
所属分类:其他
代码描述:lightningJs实现一个数字时分秒当前时间动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum=1.0,minimum=1.0,user-scalable=0" />
<style>
html,
body {
padding: 0;
margin: 0;
font-size: 16px;
background: #000;
}
body {
font-family: 'peacock';
}
canvas {
display: block;
object-fit: contain;
width: 100vw;
height: 100vh;
}
</style>
</head>
<body>
<div class="app"></div>
<script src='https://assets.codepen.io/133470/lightning-inspect.js'></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/lightning.min.js"></script>
<script>
"use strict";
const width = window.innerWidth < 450 ? 450 : window.innerWidth;
const height = window.innerHeight;
const lineHeight = 80;
const commonFont = {
fontFace: "peacock",
fontSize: lineHeight,
lineHeight: lineHeight,
textColor: 0xffffffff
};
class App extends lng.Application {
static _template() {
return {
TimeWrapper: {
flex: { direction: "row" },
mount: .5,
x: width * 0.5,
y: height * 0.5,
Hours: {
w: 100,
children: [
{ type: ChangeValue },
{ type: ChangeValue, x: 50 },
]
},
ColonOne: {
text: Object.assign({ text: ':' }, commonFont)
},
Minutes: {
w: 100,
children: [
{ type: ChangeValue },
{ type: ChangeValue, x: 50 },
]
},
ColonTwo: {
text: Object.assign({ text: ':' }, commonFont)
},
Seconds: {
w: 100,
children: [
{ type: ChangeValue },
{ type: ChangeValue, x: 50 },
]
},
AmPm: {
w: 61,
x: 10,
y: 10,
.........完整代码请登录后点击上方下载按钮下载查看
网友评论0