Unwanted 'Pulsing' when Changing an Image's Angle
Ray
ray at linkit.com
Wed Sep 17 10:24:35 EDT 2014
Alejandro,
Between you and Terry I've eliminated the unwanted pulsing as long as
the image's size doesn't change. However, there's a conflict in that
setting the lockLoc to false which also (for some reason) disallows the
changing of the image's size.
So, if I want my spinning beach ball to also 'come out at you' like
starting the spin at 10% of it's original width and height and ending up
at 100%, then I've still got problems.
My temporary solution is to simply stick with either 0, 90, 180, or 270
for the angles I set but it makes for a rough looking spin.
Do you think Jim Hurley's solution, below, holds the promise of
resolving the issue of rotating and changing size simultaneously?
Thanks,
Ray Horsley
LinkIt! Software
On 9/16/2014 9:49 PM, Alejandro Tejada wrote:
> Randy Hengst wrote
>> I don't know how to totally get rid of the wobble …
>> it seems like there is always a bit one one…
>> but I've seen the pulsing effect when
>> rotating an image with lockLoc set to true.
> Yes, lockLoc produces this effect in
> a rotating image. :(
>
> Check if this handler posted by Jim Hurley
> could help in your project:
>
> On Jan 08, 2012, jim hurley posted
> The script below will allow you to rotate an image about any predefined
> point.
>
> Create a button.
> Create an image.
> Place the button at any point relative to the image. (Perhaps use a grab me
> in a mousedown handler.)
> Click the button.
> The image will rotate about the center of the button.
> (For your application you would replace the center of rotation with the
> center of mass.)
>
>
> on mouseUp
> set the angle of img 1 to 0
> put the loc of me into myLoc
>
> --Set the coor of the rotation Pt
> put item 1 of myLoc into x0
> put item 2 of myLoc into y0
>
> --Get the loc of the image
> put the loc of img 1 into tLoc
> put item 1 of tLoc into xC
> put item 2 of tLoc into yC
>
> --Get the distance between the roation pt and the image center
> put sqrt ( (xC - x0 )^2 + (yC - y0)^2 ) into L
>
> --Get the angle of the line from the rotation center to the image center
> put atan2(yC-y0, xC-x0) *180/pi into phi0
>
> put 0 into tAngle
>
> repeat 360 times
> lock screen
> set the angle of img 1 to -tAngle
> put phi0 + tAngle into phi
> set the loc of img 1 to (x0 + L * cos(phi*pi/180)), (y0 + L *
> sin(phi*pi/180))
> unlock screen
>
> add 1 to tAngle
> wait 10 millisec --or whatever
> end repeat
> end mouseUp
>
> on mouseDown
> grab me --So that you can relocate the rotation center.
> end mouseDown
>
> From this thread:
> http://runtime-revolution.278305.n4.nabble.com/Rotate-around-Center-of-Mass-td4273701.html
>
>
>
>
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/Missing-dragData-image-tp4683313p4683321.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list