examples/test_label2.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="/js/spritejs.js"></script>
<style>
html, body {
width: 100%;
height: 100%;
overflow: hidden;
}
#stage {
position: absolute;
width: 600px;
height: 600px;
}
</style>
</head>
<body>
<div id="stage"></div>
<script>
const {Scene, Label, Group} = spritejs;
const container = document.getElementById('stage');
const scene = new Scene({
container,
width: 1200,
height: 1200,
});
const fglayer = scene.layer('fglayer');
fglayer.canvas.style.backgroundColor = '#3f097a';
const group = new Group();
group.attr({
pos: [600, 540],
});
fglayer.append(group);
const text1 = new Label();
text1.attr({
anchor: [0.5, 0.5],
pos: [600, 600],
font: 'bold 48px Arial',
fillColor: '#ffdc45',
text: '你好',
filter: 'drop-shadow(2px, 2px, 10px, #FF6040)',
});
text1.animate([
{text: '1rem'},
], {
duration: 1000,
iterations: Infinity,
});
fglayer.append(text1);
</script>
</body>
</html>