首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使0.5.0的Aframe动画在1.2.0AFrame中工作?

如何使0.5.0的Aframe动画在1.2.0AFrame中工作?
EN

Stack Overflow用户
提问于 2021-11-21 19:46:18
回答 1查看 66关注 0票数 0

代码语言:javascript
复制
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
    <script src="https://cdn.rawgit.com/donmccurdy/aframe-extras/v1.16.0/dist/aframe-extras.min.js"></script>

    
</head>

<body>
    <a-scene>

        <a-entity id="duck1" position="1 0 -3">
            <a-animation attribute="rotation" to="0 -360 0" repeat="indefinite"  easing="linear" dur="30000"> </a-animation>
            <a-entity color="#FF0000" scale="0.1 0.1 .1" position="0 0 1">
                <a-animation attribute="rotation" to="0 360 0" easing="linear" dur="4000" begin="mouseenter"> </a-animation>
                <a-box color="#FF0000" position="20 0 -10" change-color-on-hover="color: white" scale="2 3 3" collison-check="el: #otherduck; radius: 0.15; other-radius: 0.15;"> </a-box>
            </a-entity>
        </a-entity>

       
        <a-camera position="0 0.2 1.3"><a-cursor></a-cursor></a-camera>

      
    </a-scene>
</body>
</html>

动画的工作方式,我想让它看起来类似于1.2.0版本的Aframe。我试着用同样的公式。下面是我在1.2.0AFrame中试图做的事情。

代码语言:javascript
复制
<html>
<head>
   <script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
        <script src="https://cdn.jsdelivr.net/gh/donmccurdy/aframe-extras@v6.1.1/dist/aframe-extras.min.js"></script>
    
</head>

<body>
    <a-scene>

        <a-entity class="rota" id="duck1" color="#FF0000" scale="0.1 0.1 .1" position="2 0 -7" animation="property: rotation; to:0 -360 0; loop:true; easing:linear; dur:30000; pauseEvents: mouseenter; resumeEvents: " animation__mouseenter="property: rotation; to:0 360 0; easing:linear; dur:4000; startEvents: mouseenter">
            <a-box class="rota" color="#FF0000"  position="20 0 -10"  scale="2 3 3" collison-check="el: #otherduck; radius: 0.15; other-radius: 0.15;"> </a-box>
        </a-entity>
  <a-camera position="0 1.2 1.3"><a-cursor objects=".rota" ></a-cursor></a-camera>

      
    </a-scene>
</body>
</html>

在第二段代码中,它最初工作良好,然后被卡在一个特定位置上。有人能帮我修复这个错误并使它看起来类似于0.5.0AFrame版本中的代码吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-11-25 12:36:01

下面是1.2.0语法中的0.5.0代码

代码语言:javascript
复制
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
    <script src="https://cdn.rawgit.com/donmccurdy/aframe-extras/v6.1.1/dist/aframe-extras.min.js"></script>

    
</head>

<body>
    <a-scene>

        <a-entity id="duck1" position="1 0 -3"
                  animation="property: rotation; to:0 -360 0; loop: true; easing:linear; dur:3000">
            <a-entity color="#FF0000" scale="0.1 0.1 0.1" position="0 0 1"
                  animation="property:rotation; to:0 360 0; easing:linear; dur:4000; startEvents: mouseenter">
                  <a-box color="#FF0000" position="20 0 -10" change-color-on-hover="color: white" scale="2 3 3" collison-check="el: #otherduck; radius: 0.15; other-radius: 0.15;"> </a-box>
            </a-entity>
        </a-entity>
       
        <a-camera position="0 0.2 1.3"><a-cursor></a-cursor></a-camera>      
    </a-scene>
</body>
</html>

小故障:https://glitch.com/edit/#!/animation-example-0-5-to-12-0?path=index.html%3A1%3A0

我不确定我是否完全理解代码应该做什么--例如,有一个与其他鸭子的冲突处理程序,但是没有其他的鸭实体。

但是,1.2.0代码似乎与0.5代码相同。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70058020

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档