I made a little styling lib called glam
(some features are in development)
let's start off with the simplest use case. we'll make an 'index.html' page,
and assume we've setup our js bundler to output bundle.js
// Processing code by Etienne JACOB | |
// motion blur template by beesandbombs | |
// opensimplexnoise code in another tab might be necessary | |
// --> code here : https://gist.github.com/Bleuje/fce86ef35b66c4a2b6a469b27163591e | |
int[][] result; | |
float t, c; | |
float ease(float p) { |
import { Box, useDimensions, useSafeAreaInsets } from '@th3rdwave/ui'; | |
import * as React from 'react'; | |
import { updateSafeAreaInsets } from './metrics'; | |
/** | |
* This is a hack to simulate iOS keyboard behavior on Android. We use the | |
* keyboard behavior that causes the window to resize and make sure | |
* the min height stays the same when we detect that the keyboard opens. | |
*/ | |
export function AppMinHeightWrapper({ |
export type RayOptions = { | |
max?: number | |
min?: number | |
start?: number | |
} | |
/** | |
* Casts a ray in a given direction and check if it hits something. | |
* @param from - [x, y] |
var degrees2meters = function(lon,lat) { | |
var x = lon * 20037508.34 / 180; | |
var y = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180); | |
y = y * 20037508.34 / 180; | |
return [x, y] | |
} | |
//test | |
lon= -77.035974 | |
lat = 38.898717 |
I made a little styling lib called glam
(some features are in development)
let's start off with the simplest use case. we'll make an 'index.html' page,
and assume we've setup our js bundler to output bundle.js
export class Cache<T extends object, K> { | |
items = new WeakMap<T, K>() | |
get<P extends T>(item: P, cb: (item: P) => K) { | |
if (!this.items.has(item)) { | |
this.items.set(item, cb(item)) | |
} | |
return this.items.get(item)! | |
} |
#define BINKGL_LIST \ | |
/* ret, name, params */ \ | |
GLE(void, LinkProgram, GLuint program) \ | |
GLE(void, GetProgramiv, GLuint program, GLenum pname, GLint *params) \ | |
GLE(GLuint, CreateShader, GLenum type) \ | |
GLE(void, ShaderSource, GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length) \ | |
GLE(void, CompileShader, GLuint shader) \ | |
GLE(void, GetShaderiv, GLuint shader, GLenum pname, GLint *params) \ | |
GLE(void, GetShaderInfoLog, GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog) \ | |
GLE(void, DeleteShader, GLuint shader) \ |
function linkProgram(gl, vsource, fsource) | |
{ | |
if(gl == undefined) | |
{ | |
alert("Your browser does not support WebGL, try Google Chrome? Sorry."); | |
throw "Your browser does not support WebGL, try Google Chrome? Sorry."; | |
} | |
var program = gl.createProgram(), | |
vshader = createShader(gl, vsource, gl.VERTEX_SHADER), |