代码拉取完成,页面将自动刷新
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Text Box</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="docs.css">
</head>
<body>
<div class="container-fluid">
<script src="menu.js"></script>
<div class="content p-3">
<div class="container-fluid">
<h2>Text Box</h2>
<hr>
<canvas id="text-box" width="200" height="100"></canvas>
<h5 class="mt-3">Html</h5>
<pre><code><!-- Default view dimension 200 x 100. Flexible view width. -->
<canvas id="text-box" width="200" height="100"></canvas></code></pre>
<h5>JavaScript</h5>
<pre><code>/* Options */
var options = {
// Text
text: {
// Font color.
fontColor: '#dc3547',
// Background color.
bgColor: '#000000',
// Text value.
value: 'ZEU'
},
// Border color at four corners.
borderColor: '#ffa500',
// Wave color.
waveColor: '#28a748',
// Background color. Use rgba() function to have the gradient effect.
bgColor: 'rgba(0, 0, 0, 0.01)'
}
/* Constructor */
var textBox = new zeu.TextBox('text-box', options);
/* Setter */
textBox.value = 'ZEU';
textBox.textColor = '#dc3547';
textBox.textBgColor = '#000000';
textBox.bgColor = 'rgba(0, 0, 0, 0.01)';
textBox.borderColor = '#ffa500';
textBox.waveColor = '#28a748';</code></pre>
<h4>More examples</h4>
<p>
Increase view width to 300. White border and change color based on the value.
</p>
<canvas id="text-box-2" width="300" height="100"></canvas>
</div>
</div>
</div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/styles/github.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/highlight.min.js"></script>
<script src="docs.js"></script>
<script src="../dist/zeu.js"></script>
<script type="text/javascript">
/* Options */
var options = {
// Text
text: {
// Font color.
fontColor: '#dc3547',
// Background color.
bgColor: '#000000',
// Text value.
value: 'ZEU'
},
// Border color at four corners.
borderColor: '#ffa500',
// Wave color.
waveColor: '#28a748',
// Background color. Use rgba() function to have the gradient effect.
bgColor: 'rgba(0, 0, 0, 0.01)'
}
/* Constructor */
var textBox = new zeu.TextBox('text-box', options);
/* Setter */
textBox.value = 'ZEU';
textBox.textColor = '#dc3547';
textBox.textBgColor = '#000000';
textBox.bgColor = 'rgba(0, 0, 0, 0.01)';
textBox.borderColor = '#ffa500';
textBox.waveColor = '#28a748';
var textBox2 = new zeu.TextBox('text-box-2', {
viewWidth: 300,
text: {
fontColor: COLOR.white,
bgColor: COLOR.green,
value: '0'
},
borderColor: COLOR.white,
waveColor: COLOR.black,
bgColor: 'rgba(255, 255, 255, 0.02)'
});
setInterval(function() {
var value = getRandomInt(0, 100);
textBox2.value = value;
if (value <= 30) {
textBox2.textBgColor = COLOR.green;
textBox2.waveColor = COLOR.green;
} else if (value >= 60) {
textBox2.textBgColor = COLOR.red;
textBox2.waveColor = COLOR.white;
} else {
textBox2.textBgColor = COLOR.yellow;
textBox2.waveColor = COLOR.yellow;
}
}, 2000);
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。