-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclown.html
More file actions
78 lines (67 loc) · 3.06 KB
/
clown.html
File metadata and controls
78 lines (67 loc) · 3.06 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Babylon.js Video Texture</title>
<script src="https://cdn.jsdelivr.net/npm/babylonjs@5.14.1/babylon.js"></script>
<style>
body, html {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
}
#renderCanvas {
width: 100%;
height: 100%;
touch-action: none;
}
</style>
</head>
<body>
<canvas id="renderCanvas"></canvas>
<script>
window.addEventListener('DOMContentLoaded', function() {
const canvas = document.getElementById('renderCanvas');
const engine = new BABYLON.Engine(canvas, true);
window.engine = engine;
const createScene = function () {
const scene = new BABYLON.Scene(engine);
const camera = new BABYLON.ArcRotateCamera("camera1", Math.PI / 2, Math.PI / 2, 2, BABYLON.Vector3.Zero(), scene);
camera.attachControl(canvas, true);
const light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(1, 1, 0), scene);
const light1 = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(1, 1, 0), scene);
BABYLON.SceneLoader.ImportMesh('', "https://raw.githubusercontent.com/rxvolux/swiftcapes/main/", "cape.babylon", scene, function (meshes) {
const cape = meshes[0];
scene.createDefaultCameraOrLight(true, true, true);
scene.activeCamera.alpha += Math.PI;
const myMaterial = new BABYLON.StandardMaterial("myMaterial", scene);
myMaterial.diffuseColor = new BABYLON.Color3(1, 0, 1);
const videoTexture = new BABYLON.VideoTexture("video", ["https://raw.githubusercontent.com/JonJon565/jonjon565.github.io/main/Cringe_meme(1).mp4"], scene, true, true);
videoTexture.video.loop = true;
myMaterial.diffuseTexture = videoTexture;
myMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
myMaterial.emissiveColor = new BABYLON.Color3(1, 1, 1);
myMaterial.ambientColor = new BABYLON.Color3(0.23, 0.98, 0.53);
myMaterial.diffuseTexture.updateSamplingMode(BABYLON.Texture.NEAREST_SAMPLINGMODE);
cape.material = myMaterial;
const audio = new BABYLON.Sound("Audio", "https://raw.githubusercontent.com/JonJon565/jonjon565.github.io/main/Cringe_meme(1).mp4", scene, null, {
loop: true,
autoplay: true
});
audio.play();
});
return scene;
};
const scene = createScene();
engine.runRenderLoop(function () {
scene.render();
});
window.addEventListener('resize', function () {
engine.resize();
});
});
</script>
</body>
</html>