calculating point or shape real position
Posted: Fri Jun 09, 2023 4:48 am
Hi
I am new to Moho scripting
I am trying to get the real or world position of a selected shape, I use layer position and see if the layer is flipped but my main problem is how to calculate the origin
if the origin is (0,0) then the results are fine else I get strange results sometimes outside the composition dimensions
I am new to Moho scripting
I am trying to get the real or world position of a selected shape, I use layer position and see if the layer is flipped but my main problem is how to calculate the origin
if the origin is (0,0) then the results are fine else I get strange results sometimes outside the composition dimensions
Code: Select all
flipH=moho.layer.fFlipH.value
flipV=moho.layer.fFlipV.value
LayerxPos=moho.layer.fTranslation.value.x
LayeryPos=moho.layer.fTranslation.value.y
Centerx = moho:Mesh():SelectedCenter().x
Centery = moho:Mesh():SelectedCenter().y
if flipH == true then
Centerx =(Centerx-LayerxPos)*-1
print ("flipped x")
else
Centerx =Centerx+LayerxPos
end
if flipV == true then
Centery =(Centery-LayeryPos)*-1
print ("flipped y")
else
Centery =Centery+LayeryPos
end