Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kfarr committed Jul 6, 2023
1 parent 8b0fc5c commit 89bf7bd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
20 changes: 10 additions & 10 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,44 +368,44 @@ AFRAME.registerComponent('street-environment', {
const sky = this.sky;
const light1 = this.light1;
const light2 = this.light2;

if (this.data.preset === 'night') {
light1.setAttribute('light', 'intensity', 0.5 );
light2.setAttribute('light', 'intensity', 0.15 );
light1.setAttribute('light', 'intensity', 0.5);
light2.setAttribute('light', 'intensity', 0.15);
sky.setAttribute('color', '#444');
sky.setAttribute('src', '#sky-night');
sky.setAttribute('rotation', '0 0 0');
} else { // day
// TODO: create a parent with children
light1.setAttribute('light', 'intensity', 2 );
light2.setAttribute('light', 'intensity', 0.6 );
light1.setAttribute('light', 'intensity', 2);
light2.setAttribute('light', 'intensity', 0.6);
sky.setAttribute('color', '#FFF');
sky.setAttribute('src', '#sky');
sky.setAttribute('rotation', '0 255 0');
}
},
init: function () {
const el = this.el;

this.light1 = document.createElement('a-entity');
const light1 = this.light1;
light1.setAttribute('id', 'env-light1');
light1.setAttribute('light', { type: 'ambient', color: '#FFF'});
light1.setAttribute('light', { type: 'ambient', color: '#FFF' });
el.appendChild(light1);

this.light2 = document.createElement('a-entity');
const light2 = this.light2;
light2.setAttribute('id', 'env-light2');
light2.setAttribute('position', { x: 0.5, y: 1, z: -1 });
light2.setAttribute('light', { type: 'directional', color: '#FFF'});
light2.setAttribute('light', { type: 'directional', color: '#FFF' });
el.appendChild(light2);

this.sky = document.createElement('a-sky');
const sky = this.sky;
sky.setAttribute('id', 'env-sky');
el.appendChild(sky);
el.appendChild(sky);
},
update: function (oldData) {
update: function (oldData) {
this.setEnvOption();
}
});
Expand Down
14 changes: 7 additions & 7 deletions src/json-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function getElementData (entity) {
function getAttributes (entity) {
const elemObj = {};

elemObj['element'] = entity.tagName.toLowerCase();
elemObj['element'] = entity.tagName.toLowerCase();

if (entity.id) {
elemObj['id'] = entity.id;
Expand All @@ -58,7 +58,7 @@ function getAttributes (entity) {
}
if (entity.getAttribute('data-layer-name')) {
elemObj['data-layer-name'] = entity.getAttribute('data-layer-name');
}
}
const entityComponents = entity.components;

if (entityComponents) {
Expand Down Expand Up @@ -282,7 +282,7 @@ function getModifiedProperty (entity, componentName) {
return diff;
}

function createEntities (entitiesData, parentEl) {
function createEntities (entitiesData, parentEl) {
const sceneElement = document.querySelector('a-scene');
const removeEntities = ['environment', 'layers-2d'];
for (const entityData of entitiesData) {
Expand Down Expand Up @@ -333,15 +333,15 @@ function createEntityFromObj (entityData, parentEl) {
// define a primitive in advance to apply other primitive-specific geometry properties
entity.setAttribute('geometry', 'primitive', entityData['primitive']);
}

if (entityData.id) {
entity.setAttribute('id', entityData.id);
}

if (entityData.class) {
entity.classList.add(...entityData.class);
}

if (entityData['data-layer-name']) {
entity.setAttribute('data-layer-name', entityData['data-layer-name']);
}
Expand All @@ -364,5 +364,5 @@ function createEntityFromObj (entityData, parentEl) {
for (const childEntityData of entityData.children) {
createEntityFromObj(childEntityData, entity);
}
}
}
}
}

0 comments on commit 89bf7bd

Please sign in to comment.