$(window).mousemove(function (event) {
eb1.doDraw(event.pageX, event.pageY);
eb2.doDraw(event.pageX, event.pageY);
});
$('#eyeball1').click(function (){
eb1.setPupil();
});
$('#eyeball2').click(function (){
eb2.setPupil();
});
var eb1 = new Eyeball("eyeball1");
eb1.init();
var eb2 = new Eyeball("eyeball2");
eb2.init();
function Eyeball(elementId) {
var eyeball = this;
eyeball.targetId = elementId;
// Convert degrees to radians
eyeball.deg2Rad = function(degrees) {
return degrees * Math.PI / 180;
};
var isDrawing=false;
var animatedPupilScale = 0.0;
var pupilAnimationIntervalId = 0;
// return random value between 0 and 1.0
eyeball.getRandom = function() {
return Math.random();
};
// return random float value between min and max (including min and up to but not including the whole number max)
eyeball.getRandomRange = function(min,max) {
return min + ( max * this.getRandom());
};
eyeball.highlight1 = {'x':.35, 'y':.35, 'width':.16, 'height':.1, 'colour1' : {'red':200,'green':200,'blue':200, 'alpha' : 0.4}, 'colour2' : {'red':0,'green':0,'blue':0, 'alpha' : 0.0}};
eyeball.highlight2 = {'x':.64, 'y':.64, 'width':.04, 'height':.02, 'colour1' : {'red':200,'green':200,'blue':200, 'alpha' : 0.2}, 'colour2' : {'red':0,'green':0,'blue':0, 'alpha' : 0.3}};
eyeball.setPupil({'red':255,'green':0,'blue':0});
eyeball.irisColours = [{'red':0,'green':255,'blue':0},{'red':255,'green':255,'blue':0},{'red':0,'green':255,'blue':255}];
function drawSemicircle(cx, cy, r, startAngle, endAngle, increment, style)
{
var x = 0;
var y = 0;
for (a=startAngle; a <= endAngle; a += increment) {
x = r * Math.cos(deg2Rad(a)) + cx;
y = r * Math.sin(deg2Rad(a)) + cy;
plotPoint(x, y, 4, style);
}
}
// plots n as x on a semi circle and returns the y
// n cannot be outside the range 0.0 - 1.0 or the fabric of space maybe imperceptibly altered.
function circ(n) {
var angle90 = Math.PI / 2;
var radius = 1;
var y = radius * Math.sin(angle90 * n);
return y;
};
eyeball.hideRenderLayers = false;
context.globalCompositeOperation = 'lighter';
eyeball.travel = 1.0;
eyeball.pupilScale = 1.0;
eyeball.highlight1 = {"x":.35, "y":.35, "width":.16, "height":.1, "colour1" : {"red":200, "green":200, "blue":200, "alpha" : 0.4}, "colour2" : {"red":0, "green":0, "blue":0, "alpha" : 0.0}};
eyeball.highlight2 = {"x":.64, "y":.64, "width":.04, "height":.02, "colour1" : {"red":200, "green":200, "blue":200, "alpha" : 0.2}, "colour2" : {"red":0, "green":0, "blue":0, "alpha" : 0.3}};
email
root
flog archives
Disclaimer:
This page is by me for me, if you are not me then please be aware of the following
I am not responsible for anything that works or does not work including files and pages made available at www.jumpstation.co.uk
I am also not responsible for any information(or what you or others do with it) available at www.jumpstation.co.uk
In fact I'm not responsible for anything ever, so there!