TRYING SOMETHING NEW GIF ANIMATION WTH CSH SCRIPT
by Nick Hulea
HTML
<script src="http://csh.bz/kenzo/july/js/rAF.js"></script>
<script src="http://hulea.org/gifs_try/js/gif.js"></script>
<canvas id='canvas'>this requires javascript</canvas>
CSS
html, head, body, canvas {
margin: 0;
padding: 0;
border: 0;
line-height: 0;
position:fixed;
}
canvas {
cursor: none;
}
body {
/*background: url('../img/cloudsco.png');*/
}
JavaScript
(function () {
'use strict';
var animloop, brush_mod, centerContextOrigin, clear, cos, decay, degToRad, distance, handleResize, hsla, hypotenuse, imageSmoothing, initBrush, initCanvas, initConfig, initImage, initMouse, initWallpaper, paintClouds, radToDeg, resetContextOrigin, rotation, sin, sizeCanvas, sizeCanvasesToWindow, tan, tilt, time;
brush_mod = 0;
time = 0;
sin = function (a) {
return Math.sin(a);
};
cos = function (a) {
return Math.cos(a);
};
tan = function (a) {
return Math.tan(a);
};
distance = function (x1, x2, y1, y2) {
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
};
radToDeg = function (rad) {
return rad / (Math.PI / 180);
};
degToRad = function (deg) {
return deg * (Math.PI / 180);
};
hypotenuse = function (a, b) {
return Math.sqrt(a * a + b * b);
};
rotation = function (x1, x2, y1, y2) {
var dx, dy;
dx = x2 - x1;
dy = y2 - y1;
if (dx < 0) {
return Math.atan(dy / dx);
} else {
return Math.PI + Math.atan(dy / dx);
}
};
initMouse = function () {
window.Mouse = {
x: 0,
y: canvas.bottom / 2,
xs: 0,
ys: canvas.bottom / 2,
xa: -1,
xb: -1,
ya: -1,
yb: -1,
xUp: 0,
yUp: canvas.bottom / 2,
up: true,
down: false,
clicks: 0,
points: [],
downTime: 0,
events: {
up: function (e) {
Mouse.up = true;
Mouse.down = !Mouse.up;
Mouse.downTime = 0;
Mouse.xUp = Mouse.x;
return Mouse.yUp = Mouse.y;
},
down: function (e) {
e.preventDefault();
...