2021-09-04 03:54:24 -05:00
|
|
|
<template>
|
|
|
|
<MkContainer :naked="props.transparent" :show-header="false">
|
2021-11-19 04:36:12 -06:00
|
|
|
<iframe ref="live2d" class="dedjhjmo" src="https://misskey-dev.github.io/mascot-web/?scale=1.5&y=1.1&eyeY=100" @click="touched"></iframe>
|
2021-09-04 03:54:24 -05:00
|
|
|
</MkContainer>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent, markRaw } from 'vue';
|
|
|
|
import define from './define';
|
2021-11-11 11:02:25 -06:00
|
|
|
import MkContainer from '@/components/ui/container.vue';
|
|
|
|
import * as os from '@/os';
|
2021-09-04 03:54:24 -05:00
|
|
|
|
|
|
|
const widget = define({
|
|
|
|
name: 'ai',
|
|
|
|
props: () => ({
|
|
|
|
transparent: {
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
});
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
|
|
|
MkContainer,
|
|
|
|
},
|
2021-11-19 04:36:12 -06:00
|
|
|
extends: widget,
|
2021-09-04 03:54:24 -05:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
window.addEventListener('mousemove', ev => {
|
|
|
|
const iframeRect = this.$refs.live2d.getBoundingClientRect();
|
|
|
|
this.$refs.live2d.contentWindow.postMessage({
|
|
|
|
type: 'moveCursor',
|
|
|
|
body: {
|
|
|
|
x: ev.clientX - iframeRect.left,
|
|
|
|
y: ev.clientY - iframeRect.top,
|
|
|
|
}
|
|
|
|
}, '*');
|
|
|
|
}, { passive: true });
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
touched() {
|
|
|
|
//if (this.live2d) this.live2d.changeExpression('gurugurume');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.dedjhjmo {
|
|
|
|
width: 100%;
|
|
|
|
height: 350px;
|
|
|
|
border: none;
|
|
|
|
pointer-events: none;
|
|
|
|
}
|
|
|
|
</style>
|