Blanky
02-22-2009, 04:30 PM
I have some moving objects & they are using the top left spot of the object to 'hold' or 'pivot' off.
Could someone tell me how i make the 'pivot' point in the centre of the image.
I think it is somewhere in this section of code:
var k = 0
function earth(){ //controls earth and its satellite
var kr = (k *Math.PI)/360
var xearth = a - 1.5*r*Math.cos(kr)- 12
var yearth = b - 1.47*r*Math.sin(kr)
var xmoon = xearth - 2.4*rm*Math.cos(25*k)
var ymoon = yearth + 2.0*rm*Math.sin(25*k)
document.getElementById('earth').style.left = xearth
document.getElementById('earth').style.top = yearth
document.getElementById('moon').style.left = xmoon
document.getElementById('moon').style.top = ymoon
k++
if (k >7200){k=0}
}
setInterval('earth()', 182.6)
Thanks
Blanky
Could someone tell me how i make the 'pivot' point in the centre of the image.
I think it is somewhere in this section of code:
var k = 0
function earth(){ //controls earth and its satellite
var kr = (k *Math.PI)/360
var xearth = a - 1.5*r*Math.cos(kr)- 12
var yearth = b - 1.47*r*Math.sin(kr)
var xmoon = xearth - 2.4*rm*Math.cos(25*k)
var ymoon = yearth + 2.0*rm*Math.sin(25*k)
document.getElementById('earth').style.left = xearth
document.getElementById('earth').style.top = yearth
document.getElementById('moon').style.left = xmoon
document.getElementById('moon').style.top = ymoon
k++
if (k >7200){k=0}
}
setInterval('earth()', 182.6)
Thanks
Blanky