Hi,
Is there any way to build a angle finder by user interface itself. Plz find the attachment.
i can't able to rotate the needle handle.
is there any way to disable its 3D view?
Actually i need is that, i can able to rotate the handle inside this circle (mouse down) like a minute handle in a clock and show the current angle when mouse up.
How to build a 360 degree angle finder
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
How to build a 360 degree angle finder
- Attachments
-
- test.zip
- (8.27 KiB) Downloaded 197 times
Re: How to build a 360 degree angle finder
This is the code for a rotating graphic:
Code: Select all
on MouseMove
if the muovi of me then
put the loc of me into centro
put the mouseLoc into mymouse
put (item 1 of mymouse) - (item 1 of centro) into dX
put (item 2 of mymouse) - (item 2 of centro) into dY
if dx = 0 then
put 90
else
if dX > 0 then
set the angle of me to -1 * ( -1 * 360 / (2 * pi ) * atan(dY/dx))
else
set the angle of me to -1 * ( -1 * 360 / (2 * pi ) * atan(dY/dx) + 180 )
end if
end if
end if
end MouseMove
on MouseDown
set the muovi of me to true
end MouseDown
on MouseUp
set the muovi of me to false
end MouseUp
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: How to build a 360 degree angle finder
Hi firends,
maybe you didn't know, but the "mousemove" message comes with 2 parameters,
the current X and Y position of the mouse!
So you can shorten this script and also make it a bit more efficient:
Best
Klaus
maybe you didn't know, but the "mousemove" message comes with 2 parameters,
the current X and Y position of the mouse!
So you can shorten this script and also make it a bit more efficient:
Code: Select all
on MouseMove X,Y
if the muovi of me then
put the loc of me into centro
## put the mouseLoc into mymouse
## put (item 1 of mymouse) - (item 1 of centro) into dX
## put (item 2 of mymouse) - (item 2 of centro) into dY
put X - (item 1 of centro) into dX
put Y - (item 2 of centro) into dY
...
Klaus