cnchar/helper/test.html

68 lines
2.3 KiB
JavaScript
Raw Normal View History

2020-10-17 14:52:09 +08:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id='drawArea'></div>
2020-12-17 22:38:08 +08:00
<!-- <script src="../npm/packages/cnchar-all/cnchar.all.min.js"></script> -->
<script src="../npm/packages/cnchar/cnchar.min.js"></script>
<script src="../npm/packages/order/cnchar.order.min.js"></script>
<script src="../npm/packages/trad/cnchar.trad.min.js"></script>
<script src="../npm/packages/poly/cnchar.poly.min.js"></script>
<script src="../npm/packages/draw/cnchar.draw.min.js"></script>
<script src="../npm/packages/idiom/cnchar.idiom.min.js"></script>
<script src="../npm/packages/xhy/cnchar.xhy.min.js"></script>
<script src="../npm/packages/radical/cnchar.radical.min.js"></script>
2020-10-17 14:52:09 +08:00
<script>
console.log(cnchar);
console.log(cnchar.stroke('一个', 'order'));
console.log(cnchar.stroke('長城', 'count', 'order', 'name'));
// console.log(cnchar.orderToWord(['横', '撇', '捺']));
// console.log(cnchar.orderToWord(['横', '撇', '捺'], 'start'));
console.log(cnchar.spellToWord('lv2'));
console.log(cnchar.spellInfo('lǘ'));
console.log(cnchar.strokeToWord(1));
console.log('美好的地方'.spell('tone'));
cnchar.draw('中国', {
type: cnchar.draw.TYPE.NORMAL,
style: {
radicalColor: '#44f',
backgroundColor: '#eee',
length: 100,
},
});
cnchar.draw('你好', {
type: cnchar.draw.TYPE.STROKE,
style: {
radicalColor: '#44f',
backgroundColor: '#eee',
length: 60,
},
});
cnchar.draw('中国', {
type: cnchar.draw.TYPE.TEST,
style: {
radicalColor: '#44f',
backgroundColor: '#eee',
length: 100,
},
});
cnchar.draw('你好', {
type: cnchar.draw.TYPE.ANIMATION,
style: {
radicalColor: '#44f',
backgroundColor: '#eee',
length: 120,
},
});
</script>
</body>
</html>