Skip to content

Instantly share code, notes, and snippets.

@wrr
wrr / body-end.html
Created September 20, 2019 13:42
Change Shapespark teleport to view to be slower
<script>
(function() {
// This is in meters / seconds^2 (default is 4)
WALK.TELEPORT_TO_VIEW_ACCELERATION = 1;
// This is in seconds (default is 3)
WALK.TELEPORT_TO_VIEW_MAX_TIME = 100;
}());
</script>
@wrr
wrr / body-end.html
Created October 30, 2019 08:45
Disable VR mode in Shapespark
<script>
navigator.getVRDisplays = undefined;
</script>
@wrr
wrr / body-end.html
Created November 7, 2019 19:33
Add custom Shapespark menu button
<script>
var viewer = WALK.getViewer();
var button = viewer.addMenuButton(
'https://cdnjs.cloudflare.com/ajax/libs/webicons/2.0.0/webicons/webicon-facebook.png');
button.addEventListener('click', function() {
viewer.openUrl(
'https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdemo.shapespark.com%2Fsofa-facebook-share', true)
});
</script>
@wrr
wrr / body-end.html
Created December 21, 2020 17:43
Convert text into an HTML canvas and use it as a Shapespark texture.
<style>
#input-section {
position: absolute;
top: 0px;
width: 256px;
z-index: 200;
}
</style>
<div id="input-section">
@wrr
wrr / body-end.html
Created February 17, 2021 13:10
Autoplay Shapespark scene without the need for the #autoplay URL hash.
<script>
WALK.play();
</script>
@wrr
wrr / body-end.html
Created February 19, 2021 12:41
Configure how close to objects a camera can move within a Shapespark scene.
<script>
// The numbers below are in meters.
WALK.CLICK_MOVE_MIN_DISTANCE_TO_OBSTACLE = 0.7;
WALK.KEY_MOVE_MIN_DISTANCE_TO_OBSTACLE = 0.5;
</script>
@wrr
wrr / body-end.html
Created March 23, 2022 09:50
Open external URL when Shapespark view menu item is clicked
<script>
(function() {
var viewer = WALK.getViewer();
viewer.onViewSwitchStarted(function(viewName) {
if (viewName === 'PUT-THE-NAME-OF-YOUR-VIEW-MENU-ITEM-HERE') {
viewer.openUrl('https://example.com', false);
}
});
}());
</script>
@wrr
wrr / Dockerfile
Created January 25, 2024 15:24
A Dockerfile to install tinkerer (https://github.com/vladris/tinkerer)
FROM ubuntu:focal
WORKDIR /blog
RUN apt-get update
RUN apt install -y python3 pip
RUN pip install Jinja2==2.3 Sphinx==1.7.1 Babel==1.3 pyquery==1.2.8 tinkerer