Skip to content

Commit

Permalink
create new screenshot entity
Browse files Browse the repository at this point in the history
also ensure playing when in editor mode
  • Loading branch information
kfarr committed Aug 14, 2023
1 parent e461c72 commit 4038898
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<a-entity id="camera" camera="far: 1000" position="0 1.6 0" ></a-entity>
<a-entity id="leftHand" hand-controls="hand: left; handModelStyle: lowPoly; color: #ffccff"></a-entity>
<a-entity id="rightHand" hand-controls="hand: right; handModelStyle: lowPoly; color: #ffccff"></a-entity>
<a-entity id="screenshot" class="no-pause" screentock visible="false"></a-entity>
</a-entity>

<a-entity id="environment" data-layer-name="Environment" street-environment="preset: day;"></a-entity>
Expand Down Expand Up @@ -130,9 +131,12 @@
});

function buttonScreenshotTock() {
AFRAME.scenes[0].setAttribute('screentock', 'type', 'jpg');
AFRAME.scenes[0].setAttribute('screentock', 'takeScreenshot', true);
const screenshotEl = document.getElementById('screenshot');
screenshotEl.play(); // double check playing in case we're in editor mode
screenshotEl.setAttribute('screentock', 'type', 'jpg');
screenshotEl.setAttribute('screentock', 'takeScreenshot', true);
}

function startEditor() {
var sceneEl = document.querySelector('a-scene');
sceneEl.components.inspector.openInspector();
Expand Down

0 comments on commit 4038898

Please sign in to comment.