在逛博客园的时候,发现有些博客的右下角会出现一个透明的卡通小美女,并且头会跟着鼠标移动,鼠标点击之后也会有互动,研究了一下,想要实现其实并不难,下面附上源码,
<div id="live2d-widget">
<canvas id="live2dcanvas" width="300" height="600" style="position: fixed;opacity: 0.7;right: 0px;bottom: -20px;z-index: 99999;pointer-events: none;border: 1px dashed rgb(204, 204, 204);">
</canvas>
</div>
<script type="text/javascript" charset="utf-8" async="" src="https://cdn.jsdelivr.net/npm/live2d-widget@3.0.4/lib/L2Dwidget.0.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/live2d-widget@3.0.4/lib/L2Dwidget.min.js?_=1557308476616"></script>
<script type="text/javascript">
L2Dwidget.init();
</script>
<script type="text/javascript">getFollowStatus('df91d846-448f-4c9a-c764-08d6b94b3063')</script>