Skip to content

Instantly share code, notes, and snippets.

// http://www.iquilezles.org/www/articles/morenoise/morenoise.htm
// Hector Arellano
float rand(vec2 co){
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}
const float inv289 = 0.00346020761;

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
}
@damienmortini
damienmortini / ScaleX
Last active August 29, 2015 14:22 — forked from nicoptere/ScaleX
/*
JavaScript port of the following algorithm : http://scale2x.sourceforge.net/algorithm.html
*/
var scaleX = ( function( exports )
{
function getPixel32( data, x,y,w )
/*
** Copyright (c) 2012, Romain Dura [email protected]
**
** Permission to use, copy, modify, and/or distribute this software for any
** purpose with or without fee is hereby granted, provided that the above
** copyright notice and this permission notice appear in all copies.
**
** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
** WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
** MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY