Skip to content

Commit

Permalink
Merge pull request #840 from mozilla/fix/spawner-scale
Browse files Browse the repository at this point in the history
Fix scaling of spawned objects
  • Loading branch information
robertlong authored Jan 15, 2019
2 parents 92cfd94 + e3d83bc commit 3ba16fc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/gltf-component-mappings.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ AFRAME.GLTFModelPlus.registerComponent("spawner", "spawner", (el, componentName,
el.setAttribute("super-spawner", {
src: componentData.src,
resolve: true,
resize: true,
template: "#interactable-media"
});
el.setAttribute("body", {
Expand Down
2 changes: 0 additions & 2 deletions src/hub.html
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@
class="interactable"
super-networked-interactable="counter: #media-counter;"
body="type: dynamic; shape: none; mass: 1;"
scale="0.5 0.5 0.5"
animation__spawn="property: scale; delay: 50; dur: 200; from: 0.5 0.5 0.5; to: 1 1 1; easing: easeInQuad"
grabbable
stretchable="useWorldPosition: true; usePhysics: never"
hoverable
Expand Down
13 changes: 5 additions & 8 deletions src/utils/media-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,13 @@ export const addMedia = (src, template, contentOrigin, resolve = false, resize =
clearTimeout(fireLoadingTimeout);

if (!entity.classList.contains("pen") && !entity.getAttribute("animation__spawn-start")) {
entity.object3D.scale.setScalar(0.5);
entity.matrixNeedsUpdate = true;

entity.setAttribute("animation__spawn-start", {
property: "scale",
delay: 50,
dur: 300,
from: { x: 0.5, y: 0.5, z: 0.5 },
to: { x: 1.0, y: 1.0, z: 1.0 },
easing: "easeOutElastic"
delay: 0,
dur: 200,
from: { x: entity.object3D.scale.x / 4, y: entity.object3D.scale.y / 4, z: entity.object3D.scale.z / 4 },
to: { x: entity.object3D.scale.x, y: entity.object3D.scale.y, z: entity.object3D.scale.z },
easing: "easeInQuad"
});
}

Expand Down

0 comments on commit 3ba16fc

Please sign in to comment.