Code…

p.cursor = function(){
document.body.style.cursor=”default”;
};
p.cursor = function(mode){
//document.body.style.cursor=mode;
//element.style.cursor=mode;
document.body.style.cursor = ‘crosshair’;
}
p.cursor = function cursor(image,x,y){
//making a new image in order to get height and width
var newImg = new Image();
newImg.src = image;
var height = newImg.height;
var width = newImg.width;
//The values for parameters x and y must be less than the dimensions of the image
if(width >=x && height >=y)
{
document.body.style.cursor= “url(‘”+image+”‘) “+x +” “+y +””;
}
};
p.nocursor = function(){
document.body.style.cursor=”url(‘blank.cur’)”;
};

p.cursor = function(){

document.body.style.cursor=”default”;

};

————————————————————————————————–

//this function was already done

p.cursor = function(mode){

document.body.style.cursor=mode;

};

————————————————————————————————–

p.cursor = function cursor(image,x,y){

//making a new image in order to get height and width, doesn’t work in mozilla

var newImg = new Image();

newImg.src = image;

var height = newImg.height;

var width = newImg.width;

//The values for parameters x and y must be less than the dimensions of the image

if(width >=x && height >=y)

{

document.body.style.cursor= “url(‘”+image+”‘) “+x +” “+y +””;

}

};

————————————————————————————————–

p.nocursor = function(){

document.body.style.cursor=”url(‘blank.cur’)”;   //this is a transparent image but somehow it appears black

};

Of course this is not 100% yet. I have to make sure it works in all browsers.

View all of my blogs on Processing.js
View all of my blogs

Advertisements

2 thoughts on “Code…

  1. Pingback: code Updated « Anna on Stuff (Processing.js/Open Source)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s