Aframe 如何在A帧中重用动画?
有没有一种方法可以以更漂亮的方式重用相同的动画Aframe 如何在A帧中重用动画?,aframe,Aframe,有没有一种方法可以以更漂亮的方式重用相同的动画 <a-entity channel-selection class="channels" mixin="fontplane" material="opacity:0.6"> <a-animation attribute="material.opacity" begin="fade" to="0"></a-animation> <a-animation attribute="material.opac
<a-entity channel-selection class="channels" mixin="fontplane" material="opacity:0.6">
<a-animation attribute="material.opacity" begin="fade" to="0"></a-animation>
<a-animation attribute="material.opacity" begin="unfade" to="0.6"></a-animation>
<a-entity class="channels" mixin="channelfont" text="text: Channel6">
<a-animation attribute="material.opacity" begin="fade" to="0"></a-animation>
<a-animation attribute="material.opacity" begin="unfade" to="0.6"></a-animation>
</a-entity>
</a-entity>
有几种方法
第一:可以在a动画上使用混音:
<a-mixin id="fade" attribute="material.opacity" begin="fade" to="0"></a-mixin>
<a-mixin id="fade" attribute="material.opacity" begin="unfade" to="0.6"></a-mixin>
<a-entity channel-selection class="channels" mixin="fontplane" material="opacity:0.6">
<a-animation mixin="fade"></a-animation>
<a-animation mixin="unfade"></a-animation>
<a-entity class="channels" mixin="channelfont" text="text: Channel6">
<a-animation mixin="fade"></a-animation>
<a-animation mixin="unfade"></a-animation>
</a-entity>
</a-entity>
or,但不幸的是,有一些错误与可以有多个实例的组件的混合有关
第二:这也行
<head>
<title>My A-Frame Scene</title>
<script src="https://aframe.io/releases/0.3.0/aframe.min.js"></script>
<script src="https://unpkg.com/ngokevin/aframe-template-component/dist/aframe-template-component.min.js"></script>
</head>
<body>
<a-scene>
<a-assets>
<script id="fadeAnimations" type="text/html">
<a-animation></a-animation>
<a-animation></a-animation>
</script>
</a-assets>
<a-entity template="src: #fadeAnimations">
<a-entity template="src: #fadeAnimations"></a-entity>
</a-entity>
</a-scene>
我的A帧场景