Skip to content

Instantly share code, notes, and snippets.

View gist:7e01a6dd32d487dea8d70f711579139b
distance = speed * time
speed = distance/time
time = distance/speed
View gist:7d0794638f076f4a86d1245f2c72149f
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
@manudurgoni
manudurgoni / index.css
Created Feb 11, 2021
Three.js - Canvas Textured Cube
View index.css
html, body {
height: 100%;
margin: 0;
}
#c {
width: 100%;
height: 100%;
display: block;
}
@manudurgoni
manudurgoni / getDistance.js
Created Mar 21, 2018
Calculate the distance between two GPS coordinates
View getDistance.js
var rad = function(x) {
return x * Math.PI / 180;
};
var getDistance = function(p1, p2) {
var R = 6378137; // Earth’s mean radius in meter
var dLat = rad(p2.lat() - p1.lat());
var dLong = rad(p2.lng() - p1.lng());
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(rad(p1.lat())) * Math.cos(rad(p2.lat())) *
@manudurgoni
manudurgoni / meta_facebook.html
Last active Nov 25, 2017
Share a gif image on Facebook
View meta_facebook.html
<meta property="og:type" content="video.other"/>
<meta property="og:title" content="Title"/>
<meta property="og:url" content="name.gif"/>
<meta property="og:image" content="name.gif"/>
<meta property="og:image:type" content="image/gif"/>
View SmokeFilter.js
var fragmentShader = `
precision mediump float;
uniform vec2 resolution;
uniform float time;
uniform float alpha;
uniform vec2 speed;
uniform float shift;
float rand(vec2 n) {