1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 04:12:02 +08:00

default app

This commit is contained in:
Kevin Levron 2021-03-12 23:16:34 +01:00
parent 3844b109f2
commit ebe2e799ed

View File

@ -1,10 +1,10 @@
<template>
<Renderer ref="renderer" mouse-over click>
<Renderer ref="renderer" antialias orbit-ctrl resize="window">
<Camera :position="{ z: 10 }" />
<Scene>
<PointLight :position="{ y: 50, z: 50 }" />
<Box ref="box" @hover="boxHover" @click="boxClick" :size="1" :rotation="{ y: Math.PI / 4, z: Math.PI / 4 }">
<LambertMaterial :color="boxColor" />
<Box ref="box" :rotation="{ y: Math.PI / 4, z: Math.PI / 4 }">
<LambertMaterial />
</Box>
</Scene>
</Renderer>
@ -12,11 +12,6 @@
<script>
export default {
data() {
return {
boxColor: '#ffffff',
};
},
mounted() {
const renderer = this.$refs.renderer;
const box = this.$refs.box.mesh;
@ -24,28 +19,14 @@ export default {
box.rotation.x += 0.01;
});
},
methods: {
boxHover({ over }) {
if (over) this.boxColor = '#ff0000';
else this.boxColor = '#ffffff';
},
boxClick() {
console.log('click');
},
},
};
</script>
<style lang="scss">
body {
<style>
body, html {
margin: 0;
}
body, html, #app, .app { height: 100%; }
.app {
canvas {
canvas {
display: block;
}
}
</style>