layer position
Moderators: Víctor Paredes, Belgarath, slowtiger
- davoodice2
- Posts: 381
- Joined: Tue Jun 15, 2021 1:14 pm
layer position
hi friends. how to get later position? and how to set layer position?
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
- synthsin75
- Posts: 10007
- Joined: Mon Jan 14, 2008 11:20 pm
- Location: Oklahoma
- Contact:
Re: layer position
moho.layer.fTranslation:GetValue(frame)
moho.layer.fTranslation:SetValue(frame, LM_Vector3)
moho.layer.fTranslation:SetValue(frame, LM_Vector3)
- Wes
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
- davoodice2
- Posts: 381
- Joined: Tue Jun 15, 2021 1:14 pm
Re: layer position
thanks wes.synthsin75 wrote: ↑Sun Sep 12, 2021 3:39 pm moho.layer.fTranslation:GetValue(frame)
moho.layer.fTranslation:SetValue(frame, LM_Vector3)
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
- davoodice2
- Posts: 381
- Joined: Tue Jun 15, 2021 1:14 pm
Re: layer position
is it posssible to get right corner of viewport coordinates ?synthsin75 wrote: ↑Sun Sep 12, 2021 3:39 pm moho.layer.fTranslation:GetValue(frame)
moho.layer.fTranslation:SetValue(frame, LM_Vector3)
and how get mouse position in vector?
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
- synthsin75
- Posts: 10007
- Joined: Mon Jan 14, 2008 11:20 pm
- Location: Oklahoma
- Contact:
Re: layer position
The upper right corner is: moho.view:Width(), 0davoodice2 wrote: ↑Mon Sep 13, 2021 3:28 pm is it posssible to get right corner of viewport coordinates ?
and how get mouse position in vector?
The lower right corner is: moho.view:Width(), moho.view:Height()
2D layer mouse position is: mouseEvent.vec
- Wes
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
- hayasidist
- Posts: 3557
- Joined: Wed Feb 16, 2011 8:12 pm
- Location: Kent, England
Re: layer position
just for clarity:synthsin75 wrote: ↑Mon Sep 13, 2021 5:54 pmThe upper right corner is: moho.view:Width(), 0davoodice2 wrote: ↑Mon Sep 13, 2021 3:28 pm is it posssible to get right corner of viewport coordinates ?
and how get mouse position in vector?
The lower right corner is: moho.view:Width(), moho.view:Height()
2D layer mouse position is: mouseEvent.vec
view:Height() etc is pixels in the Screen coordinate system (LM_Point)
mouseEvent.pt is also in the Screen coordinate system
mouseEvent.vec is the World coordinate system (LM_Vector2)
Conversion between the systems depends on the transforms such as layer translation, camera zoom etc etc but can be effected using
LM_Graphics:ScreenToWorld and LM_Graphics:WorldToScreen
- davoodice2
- Posts: 381
- Joined: Tue Jun 15, 2021 1:14 pm
Re: layer position
Thank you very much .I continue to learn with your helps
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش