iT邦幫忙

2017 iT 邦幫忙鐵人賽
DAY 25
1
Modern Web

WebGL 與 Three.js 初探系列 第 25

[Day25] webVR 中的 jquery - aframe.js introduction

隨著 VR 的技術越來越進步,VR 的應用已經逐漸融入我們的生活中,像是不久前 google 推出的 CardBoard,HTC 的HTC ViveOculus Rift

最近由 Mozilla 基金會所推動的 WebVR,也已經推出了 v1.0 的 API Spec,目前能夠應用於 Google Cardboard、HTC Vive、Samsung Gear。

本系列文的最後會介紹 aframe 這門 webVR 框架,這門框架的也是用 three.js。

不但能夠應用於一般的網頁開發,也能夠根據平台的不同支援 VR、mobile、桌機版等等。這樣一來網頁互動的可能性又增加了一個維度。讓我們一起感受變化越來越多端的網頁開發吧!

Aframe

A web framework for building virtual reality experiences.

With HTML and Entity-Component ecosystem. Works on Vive, Rift, desktop, mobile platforms.

aframe 的特色在於他使用 HTML 標籤(web component)以及 Entity-Component System。我們可以把開發物件、場景的方式簡化為多個 tag 以及 entity。我們來看看範例中的程式碼:

<a-scene>
  <a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
  <a-box position="-1 0.5 -3" rotation="0 45 0" width="1" height="1" depth="1" color="#4CC3D9"></a-box>
  <a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
  <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
  <a-sky color="#ECECEC"></a-sky>
</a-scene>

可以發現在 aframe 當中要建立場景及物件,只要新增 tag 即可,同時我們也可以很容易地建立階層。

最後幾天的課程,我們將會用 aframe 做一些簡單的開發,希望大家都能對這個框架有基本的了解,並且應用在實際的開發當中。


上一篇
[Day24] Three.js Loader 介紹
下一篇
[Day26] aframe ECS 概覽
系列文
WebGL 與 Three.js 初探30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言