Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/boilerplate-panoexplorer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@

var el = document.createElement('a-entity');
el.dataset.id = idx;
el.setAttribute('position', {x: xPos});
el.setAttribute('position', {x: xPos, y: 0, z: 0});
el.setAttribute('mixin', 'link');
el.setAttribute('material', {shader: 'flat', src: pano.thumb});
panos[idx].el = el;
Expand Down
77 changes: 77 additions & 0 deletions examples/stress-animation/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Animation</title>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Title should mention perf

<meta name="description" content="Animation - A-Frame">
<script src="../../dist/aframe.js"></script>
</head>
<body>
<a-scene stats="true">
<a-assets>
<a-mixin id="ball" geometry="primitive: sphere; radius:1" material="shader: flat; color: red">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space after radius radius: 1, extra space before material

</a-mixin>
<a-mixin id="opacity" attribute="material.opacity" dur="2000" direction="alternate" fill="forwards"
ease="linear" repeat="indefinite" from="0.3" to="1.0"><a-mixin>
<a-mixin id="spin" attribute="rotation" dur="4000"
repeat="indefinite" easing="linear" dur="3000" to="0 0 360"><a-mixin>
</a-assets>

<a-entity position="0 0 80">
<a-entity camera look-controls wasd-controls></a-entity>
</a-entity>

<a-entity id="fans"></a-entity>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra line

</a-scene>
</body>
<script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll pull in the template component soon to help with this.

var i;
var fansEl = document.querySelector('#fans');
var numRows = 4;
var numFans = 3
var numFanRows = 3;
var numBalls = 11;
var ball =
'<a-entity>' +
'<a-entity mixin="ball">' +
'<a-animation mixin="opacity"></a-animation>' +
'</a-entity>' +
'</a-entity>';
var ballEl;
var rowEl;
var ballInitX = -15;
var fanInitX = -60;
var fanInitY = -40;
var offset;

for (var n = 0; n < numFanRows; ++n) {
var fanRow = document.createElement('a-entity');
fanRow.setAttribute('position', { x: 0, y: fanInitY - (n * fanInitY), z: 0 });
for (var k = 0; k < numFans; ++k) {
var fanEl = document.createElement('a-entity');
fanEl.setAttribute('position', { x: fanInitX - (k * fanInitX), y: 0, z: 0});
var animationEl = document.createElement('a-animation');
animationEl.setAttribute('mixin', 'spin');
fanEl.appendChild(animationEl);
for (var i = 0; i < numRows; ++i) {
var rowEl = document.createElement('a-entity');
rowEl.setAttribute('rotation', { x: 0, y: 0, z: i * (180 / numRows) });
for (var j = 0; j < numBalls; ++j) {
offset = ballInitX + 3 * j;
if (offset === 0) { continue; }
var ballEl = document.createElement('a-entity');
ballEl.setAttribute('position', { x: ballInitX + 3 * j, y: 0, z: 0 });
ballEl.innerHTML = ball;
animationEl = ballEl.querySelector('a-animation');
animationEl.setAttribute('begin', Math.random() * 2000);
rowEl.appendChild(ballEl)
}
fanEl.appendChild(rowEl);
}
fanRow.appendChild(fanEl);
}
fansEl.appendChild(fanRow);
}
</script>
</html>
2 changes: 1 addition & 1 deletion src/components/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module.exports.Component = registerComponent('camera', {
// If `active` property changes, or first update, handle active camera with system.
if (data.active && system.activeCameraEl !== this.el) {
// Camera enabled. Set camera to this camera.
system.setActiveCamera(el, camera);
system.setActiveCamera(el);
} else if (!data.active && system.activeCameraEl === this.el) {
// Camera disabled. Set camera to another camera.
system.disableActiveCamera();
Expand Down
1 change: 1 addition & 0 deletions src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ require('./visible');
require('./wasd-controls');

require('./scene/canvas');
require('./scene/debug');
require('./scene/fog');
require('./scene/keyboard-shortcuts');
require('./scene/stats');
Expand Down
3 changes: 1 addition & 2 deletions src/components/obj-model.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* global HTMLElement */
var debug = require('../utils/debug');
var registerComponent = require('../core/component').registerComponent;
var THREE = require('../lib/three');
Expand Down Expand Up @@ -39,7 +38,7 @@ module.exports.Component = registerComponent('obj-model', {

if (mtlUrl) {
// .OBJ with an .MTL.
if (HTMLElement.prototype.getAttribute.call(el, 'material')) {
if (el.hasAttribute('material')) {
warn('Material component properties are ignored when a .MTL is provided');
}
mtlLoader.setBaseUrl(mtlUrl.substr(0, mtlUrl.lastIndexOf('/') + 1));
Expand Down
5 changes: 5 additions & 0 deletions src/components/scene/debug.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var register = require('../../core/component').registerComponent;

module.exports.Component = register('debug', {
schema: { default: false }
});
Loading