1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
| const viewer = new Cesium.Viewer("cesiumContainer", { geocoder: false, homeButton: false, navigationHelpButton: false, navigationInstructionsInitiallyVisible: false, animation: false, timeline: false, fullscreenButton: false, skyBox: false, sceneModePicker: false, baseLayerPicker: false,
showRenderLoopErrors: false, shouldAnimate: true, }); viewer.cesiumWidget.creditContainer.style.display = "none";
const videoElement = document.getElementById("trailer");
const sphere = viewer.entities.add({ position: Cesium.Cartesian3.fromDegrees(-79, 39, 1000), ellipsoid: { radii: new Cesium.Cartesian3(1000, 1000, 1000), material: videoElement, }, });
viewer.trackedEntity = sphere;
let synchronizer; Sandcastle.addToggleButton("Clock synchronization", false, function (checked) { if (Cesium.defined(synchronizer)) { synchronizer = synchronizer.destroy(); videoElement.playbackRate = 1.0; return; }
synchronizer = new Cesium.VideoSynchronizer({ clock: viewer.clock, element: videoElement, }); });
let isRepeating = true; Sandcastle.addToggleButton("Image Repeat", isRepeating, function (checked) { isRepeating = checked; });
sphere.ellipsoid.material.repeat = new Cesium.CallbackProperty(function ( time, result ) { if (!Cesium.defined(result)) { result = new Cesium.Cartesian2(); } if (isRepeating) { result.x = 8; result.y = 8; } else { result.x = 1; result.y = 1; } return result; }, false);
Sandcastle.addToggleButton("Video Overlay", true, function (checked) { if (checked) { videoElement.style.display = ""; } else { videoElement.style.display = "none"; } });
viewer.scene.renderError.addEventListener(function () { if (!videoElement.paused) { videoElement.pause(); } viewer.cesiumWidget.showErrorPanel( "This browser does not support cross-origin WebGL video textures.", "", "" ); });
|