Skip to Content
Welcome to Vyno! 🍷

.switch()

切换角色的资源。适用于 ImageFigure 和 Live2dFigure。

函数签名

switch(path: string): Figure

ImageFigure 切换图片

const qing = createImageFigure("qing", { name: "秦", path: "/figures/qing/normal.png", }); // 切换到其他表情图片 qing.switch("/figures/qing/happy.png"); qing.switch("/figures/qing/sad.png");

Live2dFigure 切换模型

const anon = createLive2dFigure("anon", { name: "千早爱音", path: "/figures/anon/casual/model.json", }); // 切换服装/模型 anon.switch("/figures/anon/live_sr_01/model.json"); // 切换回原模型 anon.switch("/figures/anon/casual/model.json");

链式调用

// 切换模型 + 对话 anon.speak("换一身衣服") .switch("/figures/anon/live_sr_01/model.json");

注意事项

  • 切换时会保持当前的位置和缩放属性
  • Live2D 模型切换需要加载时间
Last updated on