mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
33 lines
611 B
Vue
33 lines
611 B
Vue
<template>
|
|
<Renderer ref="renderer" antialias orbit-ctrl resize="window">
|
|
<Camera :position="{ z: 10 }" />
|
|
<Scene>
|
|
<PointLight :position="{ y: 50, z: 50 }" />
|
|
<Box ref="box" :rotation="{ y: Math.PI / 4, z: Math.PI / 4 }">
|
|
<LambertMaterial />
|
|
</Box>
|
|
</Scene>
|
|
</Renderer>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
mounted() {
|
|
const renderer = this.$refs.renderer;
|
|
const box = this.$refs.box.mesh;
|
|
renderer.onBeforeRender(() => {
|
|
box.rotation.x += 0.01;
|
|
});
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style>
|
|
body, html {
|
|
margin: 0;
|
|
}
|
|
canvas {
|
|
display: block;
|
|
}
|
|
</style>
|