2017-04-15 103 views
4

我想渐变颜色添加到球体,目前我设置的颜色:添加渐变色,以非球面

<a-sphere position="1 1 0" color="#ef2d5e"> 
      <a-animation attribute="rotation" to="0 360 0" dur="10000" easing="linear" repeat="indefinite"> 
</a-animation> 
</a-sphere> 

Demo

如何添加渐变到球?有什么办法吗?

回答

3

尝试https://github.com/zcanter/aframe-gradient-sky

<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script> 

<script src="https://rawgit.com/zcanter/aframe-gradient-sky/master/dist/gradientsky.min.js"></script> 

<a-scene> 

     <!-- A Sphere --> 
     <a-entity geometry="primitive: sphere" material="shader: gradient; topColor: 255 100 100; bottomColor: 100 100 200; offset: 0.0001" position="0 0 -5"></a-entity> 

    </a-scene> 
+0

谢谢您的回答,我该怎么做同样只用球不是整个场景? – bhansa

+0

'' – ngokevin

+0

无法解决它,你能更新我的小提琴并粘贴在这里。我试过但没有工作。 – bhansa