code Updated

Apparently I cannot have multiple functions with the same name even though they have different parameters. Here is a link to my previous code. So I have rewritten my cursor() functions. I can also say that it works in both Chrome and Firefox. Now just to get it on github, tomorrow’s task.

p.cursor = function(){
if(arguments.length ==0)
{
document.body.style.cursor=”default”;
}
else if(arguments.length ==1)//cursor(mode)
{
document.body.style.cursor=arguments[0];
}
else if(arguments.length == 3)//cursor(image,x,y)
{
//making a new image in order to get height and width
var newImg = new Image();
newImg.src = arguments[0];
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 >=arguments[1] && height >=arguments[2])
{
document.body.style.cursor= “url(‘”+arguments[0]+”‘) “+arguments[1] +” “+arguments[2] +”, auto”;
}
}
};

p.cursor = function(){

if(arguments.length ==0)

{

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

}

else if(arguments.length ==1)//cursor(mode)

{

document.body.style.cursor=arguments[0];

}

else if(arguments.length == 3)//cursor(image,x,y)

{

//making a new image in order to get height and width

var newImg = new Image();

newImg.src = arguments[0];

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 >=arguments[1] && height >=arguments[2])

{

document.body.style.cursor= “url(‘”+arguments[0]+”‘) “+arguments[1] +” “+arguments[2] +”, auto”;

}

}

};

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

Advertisements

One thought on “code Updated

  1. Pingback: 0.1 Release Day! « The Crazed Mind of an Aspiring Developer

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