Skip to content
Projetos

NarraLeaf/narraleaf-react

Ver no GitHub

Sobre

Make your own visual novel using a lightweight front-end react visual novel framework.

Desenvolvimento web e de aplicativos

Como estes números são medidos

Crescimento medido de estrelas

em 24 h
0
em 7 dias
0
em 15 dias
Coletando histórico
em 1 mês
Coletando histórico

Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.

README.md

Original
NarraLeaf Logo

NarraLeaf-React

A React visual novel player framework

English | 简体中文

What is NarraLeaf-React?

NarraLeaf-React is a lightweight front-end visual novel player.
NL focuses on visual novel playing, so the user interface can be customized very easily.

It doesn't use any rendering libraries and can be used on any web platform (e.g. Electron)

Why NarraLeaf-React?

  • Lightweight: NarraLeaf-React is a front-end framework, and it doesn't use any rendering libraries.
  • Customizable: You can customize the UI as you like, even replace the whole components.
  • Easy to use: It is easy to use and has a simple API that is built for developers. Based on OOP principles.

Scripting

NarraLeaf-React uses TypeScript for all scripting, so you don't have to learn a whole new language to use it.

It also has a highly abstracted and easy-to-use API, for example:

import {Character, Menu, Scene, c, b} from "narraleaf-react";
const scene1 = new Scene("Scene1: Hello World", {
  background: "/link/to/background.jpg",
});

const jS = new Character("John Smith");
const jD = new Character("John Doe");

scene1.action([
  jS`Hello, world!`,
  jS`This is my first ${b("NarraLeaf")} story.`,
  jS`Start editing ${c("src/story.js", "#00f")} and enjoy the journey!`,

  jD`Also, don't forget to check out the ${c("documentation", "#00f")}!`,

  "By the way, the documentation is available on https://www.narraleaf.com/docs/narraleaf-react",
  "You can also visit the website for demo and more information.",

  Menu.prompt("Start the journey")

    .choose("Yes I will!", [
      jS`Great! Let's start the journey!`,
      jS`You can open issues on GitHub if you have any questions.`
    ])

    .choose("No, I'm going to check the documentation", [
      jS`Sure! Take your time!`
    ])
]);

For more information, please visit the NarraLeaf-React documentation.

Recent engine APIs

  • LiveGame.captureImage({ maxEdge, type, quality, backgroundColor }) draws a screenshot at the wanted size and encodes it once
  • LiveGame.deserialize(save, { requireMatchingStory: true }) refuses a save written by another story before changing state
  • registerWordRenderer(id, component, { interactive: false }) lets a purely visual text effect pass the player's clicks through to the line
  • Backlog say entries carry the avatar shown at that line, while restored saves refuse unsafe image and CSS URLs
  • Layer({ parallax }) and Scene({ backgroundLayerParallax }) place layers at different distances from the camera
  • Video.show() and Video.hide() accept { duration, easing } to fade a clip in or out
  • GameConfig.preload replaces the built-in preload strategy, while preloadGate and the image cache budgets control the default path
  • Sound.play() resolves once playback starts; pass { waitForEnd: true } when the story must wait for the clip
  • GameState.getImageCache(), AudioManager.getCacheStats() and retainOnly() expose cache residency and budgets

Get Started

Install

npm install narraleaf-react

Documentation

Read more in the NarraLeaf-React documentation.

License

NarraLeaf-React is licensed under the MPL-2.0 License.

We updated the license to MPL-2.0 on 2024-9-24.

Contributing

We welcome all contributions.
If you have any ideas, just open an issue or a pull request.

Explore projetos relacionados

Carregando…