使用 A-Frame 库在悬停时缩放对象
obj scale on hover with A-Frame Library
我正在学习如何使用 Javascript 和 A-Frame 库,我正在尝试在将鼠标悬停在 obj 模型上时更改它的比例。
我正在学习使用组件构建教程,但我的代码有问题,它似乎对我不起作用。
这是我的代码
<a-scene>
<a-assets>
<audio id="click-sound" src="audioclick.mp3"></audio>
<a-asset-item id="e45-obj" src="E45.obj"></a-asset-item>
<a-asset-item id="e45-mtl" src="E45.mtl"></a-asset-item>
<script id="link" type="text/nunjucks">
<a-entity class="link"
sound="on: click; src: #click-sound"
event-set__1="_event: mousedown; scale: .5 .5 .5"
event-set__2="_event: mouseup; scale: 0.8 0.8 0.5"
event-set__3="_event: mouseenter; scale: 0.8 0.8 0.5"
event-set__4="_event: mouseleave; scale: .5 .5 .5"></a-entity>
</script>
</a-assets>
<a-entity template="src: #link">
<a-obj-model scale=".5 .5 .5" rotation="0 -45 -45" position="0 1.5 -5" src="#e45-obj" mtl="#e45-mtl">
<a-animation attribute="position" to="0 2.2 -5" direction="alternate" dur="2000"
repeat="indefinite"></a-animation>
</a-obj-model></a-entity>
</a-scene>
提前致谢!
<a-obj-model event-set__scale="_event: mouseenter; scale: 2 2 2"></a-obj-model>
我正在学习如何使用 Javascript 和 A-Frame 库,我正在尝试在将鼠标悬停在 obj 模型上时更改它的比例。
我正在学习使用组件构建教程,但我的代码有问题,它似乎对我不起作用。
这是我的代码
<a-scene>
<a-assets>
<audio id="click-sound" src="audioclick.mp3"></audio>
<a-asset-item id="e45-obj" src="E45.obj"></a-asset-item>
<a-asset-item id="e45-mtl" src="E45.mtl"></a-asset-item>
<script id="link" type="text/nunjucks">
<a-entity class="link"
sound="on: click; src: #click-sound"
event-set__1="_event: mousedown; scale: .5 .5 .5"
event-set__2="_event: mouseup; scale: 0.8 0.8 0.5"
event-set__3="_event: mouseenter; scale: 0.8 0.8 0.5"
event-set__4="_event: mouseleave; scale: .5 .5 .5"></a-entity>
</script>
</a-assets>
<a-entity template="src: #link">
<a-obj-model scale=".5 .5 .5" rotation="0 -45 -45" position="0 1.5 -5" src="#e45-obj" mtl="#e45-mtl">
<a-animation attribute="position" to="0 2.2 -5" direction="alternate" dur="2000"
repeat="indefinite"></a-animation>
</a-obj-model></a-entity>
</a-scene>
提前致谢!
<a-obj-model event-set__scale="_event: mouseenter; scale: 2 2 2"></a-obj-model>