- img sequence to mp4
ffmpeg -framerate <fps> -pattern_type glob -i "*.jpg" -c:v libx264 -r 30 -pix_fmt yuv420p output.mp4
where 24 is the desired fps
- mov to mp4
ffmpeg -i input.mov -vcodec h264 -acodec mp2 output.mp4
- mp4 to gif
| let session = await navigator.xr.requestSession('immersive-ar'); | |
| let rafId = null; | |
| session.addEventListener('selectstart', event => { | |
| inputSource = event.inputSource | |
| onStart(getEvent()); | |
| rafId = requestAnimationFrame(updateInput); | |
| }); | |
| session.addEventListener('selectend', event => { |
| // Check your coordinates space! | |
| // Lat, Lon (SW) = -Lat, -Lon (NE) | |
| // Lat, Lon (NW) = -Lat, Lon (NE) | |
| // etc | |
| var ray = new Ray() | |
| /* | |
| positionToUV | |
| Converts a 3D world position to UV coordinates on a given sphere mesh |
ffmpeg -framerate <fps> -pattern_type glob -i "*.jpg" -c:v libx264 -r 30 -pix_fmt yuv420p output.mp4
where 24 is the desired fps
ffmpeg -i input.mov -vcodec h264 -acodec mp2 output.mp4
| // Doesn't require pow() | |
| // Not smoothed i.e. like a triangle function | |
| float linearParabola(float x) { | |
| return 1.0 - abs(x * 2.0 - 1.0); | |
| } | |
| // Slightly smoothed, no math function | |
| float parabola(float x) { | |
| return 4.0 * x * (1.0 - x); |
width: 300px;
height: 240px;
el.style.fontSize = Math.min(width, height) / 360 * 16 + 'px'
| // Need to toggle the autoClear flag to avoid breaking rendering to RenderTarget | |
| function update(dt) { | |
| renderer.render(scene, camera); | |
| renderer.autoClear = false; | |
| renderer.clearDepth(); | |
| renderer.render(orthoScene, orthoCamera); | |
| renderer.autoClear = true; | |
| } |
| // There's always some fiddling because the GLTF exports a whole scene | |
| // with root bone and skinned mesh already appended to it. | |
| let gltf = loadedGltf; | |
| let skinned; | |
| gltf.scene.traverse(function(object) { | |
| if (object instanceof THREE.SkinnedMesh) { | |
| skinned = object; | |
| } | |
| }) |
| // https://discourse.threejs.org/t/functions-to-calculate-the-visible-width-height-at-a-given-z-depth-from-a-perspective-camera/269 | |
| function visibleHeightAtDepth(depth, camera) { | |
| // compensate for cameras not positioned at z=0 | |
| const cameraOffset = camera.position.z; | |
| if ( depth < cameraOffset ) depth -= cameraOffset; | |
| else depth += cameraOffset; | |
| // vertical fov in radians | |
| const vFOV = camera.fov * Math.PI / 180; | |
| // Math.abs to ensure the result is always positive |
| Object.defineProperties(THREE.Object3D.prototype, { | |
| x: { | |
| get: function() { | |
| return this.position.x | |
| }, | |
| set: function(value) { | |
| this.position.x = value | |
| } | |
| }, | |
| y: { |