添加石蒜模拟器网页小组件

发布于 6 天前  17 次阅读


功能

  • 注册并使用你自己的角色
  • 自动缩放适应,最小 120px
  • 按住立牌拖拽,松手后立牌会向反方向弹跳
  • 底座控制栏切换角色和其他功能
  • 自走模式,以随机间隔施加一个大小随机的力
  • CDN/NPM 引入,自定义参数,链式调用

教程

1.在主题配置文件中找到 extends 在 head 中添加以下内容:

head: # 在head中插入 / Insert in head
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sakana-widget@2.7.0/lib/sakana.min.css" />

2.在主题配置文件中找到 extends 在 body 中添加以下内容:

body: # 在body中插入 / Insert in body
- <script>
  const sakanaWidget = document.createElement("div");
  sakanaWidget.id = "sakana-widget";
  sakanaWidget.style.position = "fixed";
  sakanaWidget.style.bottom = "12px";
  sakanaWidget.style.right = "0";
  sakanaWidget.style.zIndex = "999";
  document.body.appendChild(sakanaWidget);
  function initSakanaWidget() {
  new SakanaWidget().mount('#sakana-widget');}
  </script>
- <script
  async
  onload="initSakanaWidget()"
  src="https://cdn.jsdelivr.net/npm/sakana-widget@2.7.0/lib/sakana.min.js"></script>
  • 至于效果呢,就是有人会在车上放一个立牌,可以左右摇晃的那种,大概就是这种效果,还是挺不错的,感兴趣可以自己试着弄一个玩玩