(Hola!) Hi!
(Necesito que me expliquen esto, de javascript
I need explain javascritp this:
function addCustom(color1,color2,color3)
{
var x=document.steed;
var newDiff = 0;
var Diff1 = 0;
var Diff2 = 0;
var Diff3 = 0;
var totalDiff = 999;
var newSteed = 0;
var custom1 = parseInt(color1);
var custom2 = parseInt(color2);
var custom3 = parseInt(color3);
counter++;
if (current1 == 0 && current2 == 0 && current3 == 0)
{
current1 = custom1;
current2 = custom2;
current3 = custom3;
}
else
{
current1 = Math.floor(current1 * 0.9) + Math.floor(custom1 * 0.1);
current2 = Math.floor(current2 * 0.9) + Math.floor(custom2 * 0.1);
current3 = Math.floor(current3 * 0.9) + Math.floor(custom3 * 0.1);
}
for (i=0; i < steedName.length; i++)
{
Diff1 = Math.abs(current1 - steedName[i][1]);
Diff2 = Math.abs(current2 - steedName[i][2]);
Diff3 = Math.abs(current3 - steedName[i][3]);
newDiff = Math.sqrt((Diff1*Diff1) + (Diff2*Diff2) + (Diff3*Diff3));
if (totalDiff >= newDiff)
{
if (steedName[i][4] == 1)
{
if (newDiff == 0)
{
newSteed = i;
totalDiff = newDiff;
}
}
else
{
newSteed = i;
totalDiff = newDiff;
}
}
}
document.getElementById("addsteed").innerHTML = counter + " | " + custom1 + " - " + custom2 + " - " + custom3 + " | " + current1 + " | " + current2 + " | " + current3 + " | " + (current1 + current2 + current3) + " | " + steedName[newSteed][0] + "<br />" + document.getElementById("addsteed").innerHTML;
}
Thk! (gracias!)