A-Frame 前端WebVR以及后端Flask服务器搭建(一)

最近一直都在搞这些事,坑太多了一个一个去填,收获也很多。做出了一定成果及时总结养成好习惯。


A-Frame这个框架基于webGL中three.js模块,目前踩的坑来看,这是一个未完成的框架,我愿意与它共同成长。

A-Frame继承了很多three.js的很多模块,比如相机、光照、几何模型等等,还有很多新的功能,同时社区也在不断成长,更多模块正在开发。
一个简单的例子:

<html>
<head>
<script src="https://aframe.io/releases/0.5.0/aframe.min.js">
</script>
</head>
<body>
<a-scene>
        <a-assets>
            <img id="boxTexture" src="https://i.imgur.com/mYmmbrp.jpg">
             <img id="skyTexture"
      src="https://cdn.aframe.io/360-image-gallery-boilerplate/img/sechelt.jpg">
       <img id="groundTexture" src="https://cdn.aframe.io/a-painter/images/floor.jpg"></a-assets>
       <a-box src="#boxTexture" position="0 2 -5" rotation="0 45 45" scale="2 2 2">
            <a-animation attribute="position" to="0 2.2 -5" direction="alternate" dur=2000 repeat="indefinite"></a-animation>
        </a-box>
        <a-sky src="#skyTexture"></a-sky>
        <a-light type="ambient" color="#E3E3E3"></a-light>
          <a-light type="point" intensity="2" position="2 4 4"></a-light>
          <a-text value="Hello" color="#BBB"
        position="-0.9 0.2 -3" scale="1.5 1.5 1.5"></a-text>
 <a-camera>
            <a-cursor></a-cursor>
        </a-camera>
    </a-scene>
</body>
</html>    

懂前端的大概都懂是什么意思,主要的三维模型内容都在 <a-scene> </a-scene>中,首先是资源<a-assets>,包括纹理贴图,模型等,然后是box模型,其中定义了其位置,大小,角度等属性,还添加纹理,并定义了其动画效果,接下来是天空盒,灯光效果,相机等。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值