autotypejs
use for typing automatically.
介绍
使用原生JavaScript(es6)实现的自动打字效果。
效果图

示例代码(vue):
<template>
<div class="type-container"></div>
</template>
<script>
import AutoType from "autotypejs";
export default {
name: "AutoType",
mounted() {
const autoType = new AutoType(".type-container");
autoType.config({
loop: false,
show_cursor: true,
});
autoType
.setStage({
type: "add",
text: "如梦今",
duration: 1000,
style: {
"font-weight": "bold",
"font-size": "23px",
},
})
.setStage({
type: "delete",
delete_count: 1,
duration: 300,
})
.setStage({
text: "令",
duration: 300,
style: {
"font-weight": "bold",
"font-size": "23px",
},
})

autotypejs是一个使用原生JavaScript(es6)实现的自动打字库,支持Vue。提供了配置、设置阶段、启动任务和监听任务完成事件等API。在使用时需注意DOM节点的挂载和游标的样式类配置。
最低0.47元/天 解锁文章
1063

被折叠的 条评论
为什么被折叠?



