aframe-alongpath-component
Version:
A-Frame Component that allows entities to follow predefined paths
32 lines (27 loc) • 1.13 kB
HTML
<html>
<head>
<script src="../build.js"></script>
</head>
<body>
<a-scene inspector="url: https://rawgit.com/aframevr/aframe-inspector/master/dist/aframe-inspector.min.js">
<a-assets>
</a-assets>
<a-curve id="track1">
<a-curve-point position="-2 2 -3" geometry="primitive:box; height:0.1; width:0.1; depth:0.1" material="color:#ff0000"></a-curve-point>
<a-curve-point position="0 1 -3" geometry="primitive:box; height:0.1; width:0.1; depth:0.1" material="color:#ff0000"></a-curve-point>
<a-curve-point position="2 2 -3" geometry="primitive:box; height:0.1; width:0.1; depth:0.1" material="color:#ff0000"></a-curve-point>
</a-curve>
<a-box color="#ff0000" width="0.1" height="0.3" depth="0.1"
alongpath="curve: #track1; loop:true; dur:6000; rotate:true;">
</a-box>
<a-draw-curve curveref="#track1" material="shader: line; color: red;"></a-draw-curve>
<a-entity id="player" position="0 0 0">
<a-camera>
<a-cursor></a-cursor>
</a-camera>
</a-entity>
<a-sky id="sky" color="#000"></a-sky>
</a-scene>
</body>
</html>