使用A-Frame Library悬停时的obj比例

时间:2017-02-24 14:04:12

标签: aframe

我正在学习如何使用Javascript和A-Frame库,我试图在将鼠标悬停在它上面时改变obj模型的比例。

我正在关注Building with Components教程,但我的代码出了问题,而且它似乎与我无关。

这是我的代码

<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>

提前致谢!

1 个答案:

答案 0 :(得分:0)

{ provide: IOpenService, useClass: OpenService }