|
58 | 58 | <script src="https://cdn.jsdelivr.net/npm/three@0.132.2/examples/js/postprocessing/BokehPass.js"></script> |
59 | 59 | <script> |
60 | 60 | let resolveReady; |
61 | | - window.__tailwindReady = new Promise((resolve) => { |
| 61 | + var loadPromise = new Promise((resolve) => { |
62 | 62 | resolveReady = resolve; |
63 | 63 | }); |
| 64 | + var hangTimer = new Promise((resolve) => setTimeout(resolve, 15000)); |
| 65 | + window.__tailwindReady = Promise.race([loadPromise, hangTimer]); |
64 | 66 |
|
65 | 67 | (function () { |
66 | 68 | function parseVars() { |
|
72 | 74 | for (const d of defs) defaults[d.id] = d.default; |
73 | 75 | var byComp = window.__hfVariablesByComp; |
74 | 76 | if (byComp && byComp[compId]) return Object.assign(defaults, byComp[compId]); |
75 | | - var el = document.querySelector('[data-composition-id="' + compId + '"][data-variable-values]'); |
| 77 | + var el = document.querySelector( |
| 78 | + '[data-composition-id="' + compId + '"][data-variable-values]', |
| 79 | + ); |
76 | 80 | if (el) { |
77 | 81 | try { |
78 | 82 | return Object.assign(defaults, JSON.parse(el.getAttribute("data-variable-values"))); |
|
93 | 97 |
|
94 | 98 | function hexToVec3(hex) { |
95 | 99 | const n = parseInt(hex.replace("#", ""), 16); |
96 | | - return new THREE.Vector3(((n >> 16) & 255) / 255, ((n >> 8) & 255) / 255, (n & 255) / 255); |
| 100 | + return new THREE.Vector3( |
| 101 | + ((n >> 16) & 255) / 255, |
| 102 | + ((n >> 8) & 255) / 255, |
| 103 | + (n & 255) / 255, |
| 104 | + ); |
97 | 105 | } |
98 | 106 |
|
99 | 107 | try { |
|
120 | 128 | const DISSOLVE_END = Number(vars.dissolveEnd) || 7.1; |
121 | 129 | const PARTICLE_COLOR_VEC = hexToVec3(vars.particleColor || "#1a7aff"); |
122 | 130 | const BG_COLOR = vars.bgColor || "#05070d"; |
123 | | - const MODEL_URL = vars.modelUrl || "https://static.heygen.ai/hyperframes-oss/registry/blocks/three-dissolve/scene.gltf"; |
| 131 | + const MODEL_URL = |
| 132 | + vars.modelUrl || |
| 133 | + "https://static.heygen.ai/hyperframes-oss/registry/blocks/three-dissolve/scene.gltf"; |
124 | 134 |
|
125 | 135 | const container = document.querySelector('[data-composition-id="three-dissolve"]'); |
126 | 136 | const bgGradient = `radial-gradient(circle at 50% 42%, ${BG_COLOR}44 0%, ${BG_COLOR}cc 44%, ${BG_COLOR} 100%)`; |
|
458 | 468 | box.getCenter(bCenter); |
459 | 469 | modelMesh.position.sub(bCenter); |
460 | 470 | var maxDim = Math.max(bSize.x, bSize.y, bSize.z); |
461 | | - var visibleHeight = 2 * camera.position.z * Math.tan(THREE.MathUtils.degToRad(camera.fov / 2)); |
| 471 | + var visibleHeight = |
| 472 | + 2 * camera.position.z * Math.tan(THREE.MathUtils.degToRad(camera.fov / 2)); |
462 | 473 | var targetSize = visibleHeight * 0.32; |
463 | 474 | root.scale.setScalar(maxDim > 0 ? targetSize / maxDim : 1); |
464 | 475 | modelMesh.updateMatrixWorld(true); |
|
0 commit comments