0.0.9 • Published 2 years ago

@nerdos/typewriter v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Typewriter - WIP

$ yarn add typewriter

# or

$ pnpm install typewriter

Example

import Typewriter from "./dist/index.mjs";
(async () => {
  const typewriter = new Typewriter({
    containerId: "output",
    // cursorBG: '#ee30a1',
  });
  await typewriter.sleep(2000);
  await typewriter.typingFunction();
  await typewriter.typing(" ");
  await typewriter.typingFunctionName("beepInterval");
  await typewriter.typing("() ");
  await typewriter.typingBlock("{}");
  await typewriter.sleep(1800);
  await typewriter.typingEnter();
  await typewriter.sleep(500);
  await typewriter.typingComment("// function ");
  await typewriter.typingComment(["comes here", "detail..."]);
  await typewriter.sleep(1500);
  await typewriter.newLine(1);
  await typewriter.sleep(1200);
  await typewriter.typingFunction("return ");
  await typewriter.typingFunctionName("setInterval");
  await typewriter.typingBlock("()");
  await typewriter.sleep(1200);
  await typewriter.typing("() => ");
  await typewriter.typingBlock("{}");
  await typewriter.sleep(800);
  await typewriter.typingEnter(1);
  await typewriter.typingFunction("if ");
  await typewriter.typingBlock("()");
  await typewriter.typingFunctionName("this");
  await typewriter.typing(".");
  await typewriter.typingVariable("cursorElement");
  await typewriter.relocateCursor();
  await typewriter.typing(" ");
  await typewriter.typingBlock("{}");
  await typewriter.sleep(1200);
  await typewriter.typingEnter(2);
  await typewriter.typingFunction("const ");
  await typewriter.typingBlock("{}");
  await typewriter.typingVariable(" visibility ");
  await typewriter.relocateCursor();
  await typewriter.typingFunction(" = ");
  await typewriter.typingFunctionName("this");
  await typewriter.typing(".");
  await typewriter.typingVariable("cursorElement");
  await typewriter.typing(".");
  await typewriter.typingVariable("style");
  await typewriter.sleep(1200);
  await typewriter.newLine(3);
  await typewriter.typingComment("// More detail...");
})();

License

MIT License © 2022 Captain Martin