Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.
brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
var cameraZ = camera.position.z; | |
var planeZ = 5; | |
var distance = cameraZ - planeZ; | |
var aspect = viewWidth / viewHeight; | |
var vFov = camera.fov * Math.PI / 180; | |
var planeHeightAtDistance = 2 * Math.tan(vFov / 2) * distance; | |
var planeWidthAtDistance = planeHeightAtDistance * aspect; | |
// or |
// isAutoplaySupported(callback); | |
// Test if HTML5 video autoplay is supported | |
isAutoplaySupported = function(callback) { | |
// Is the callback a function? | |
if (typeof callback !== 'function') { | |
console.log('isAutoplaySupported: Callback must be a function!'); | |
return false; | |
} | |
// Check if sessionStorage exist for autoplaySupported, | |
// if so we don't need to check for support again |
// Fix iOS Audio Context by Blake Kus https://gist.github.com/kus/3f01d60569eeadefe3a1 | |
// MIT license | |
(function() { | |
window.AudioContext = window.AudioContext || window.webkitAudioContext; | |
if (window.AudioContext) { | |
window.audioContext = new window.AudioContext(); | |
} | |
var fixAudioContext = function (e) { | |
if (window.audioContext) { | |
// Create empty buffer |
/** | |
* SVG Fixer | |
* | |
* Fixes references to inline SVG elements when the <base> tag is in use. | |
* Firefox won't display SVG icons referenced with | |
* `<svg><use xlink:href="#id-of-icon-def"></use></svg>` when the <base> tag is on the page. | |
* | |
* More info: | |
* - http://stackoverflow.com/a/18265336/796152 | |
* - http://www.w3.org/TR/SVG/linking.html |
Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative
float rand(float n){return fract(sin(n) * 43758.5453123);}
float noise(float p){
float fl = floor(p);
float fc = fract(p);
var svg = document.getElementById('graph'), | |
xml = new XMLSerializer().serializeToString(svg), | |
data = "data:image/svg+xml;base64," + btoa(xml), | |
img = new Image() | |
img.setAttribute('src', data) | |
document.body.appendChild(img) |