-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Refactors component updates to minimize the number of string parsings… #1323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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> | ||
| <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"> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. space after radius |
||
| </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> | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extra line |
||
| </a-scene> | ||
| </body> | ||
| <script> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
| 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 } | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Title should mention perf