模拟人类打字效果的 js 库:TheaterJS
jopen
10年前
TheaterJS 模拟人类打字效果的 js 库。
- Everything you need to know is demonstrated and explained in this codepen.
- The demo is also available on the TheaterJS page.
示例
var theater = new TheaterJS(); theater .describe("Vader", .8, "#vader") .describe("Luke", .6, "#luke"); theater .write("Vader:Luke.", 600) .write("Luke:What?", 400) .write("Vader:I am...", 400, " your father."); theater .on("say:start, erase:start", function () { // add blinking caret }) .on("say:end, erase:end", function () { // remove blinking caret }) .on("*", function () { // do something });