Unwanted 'Pulsing' when Changing an Image's Angle
Terry Judd
terry.judd at unimelb.edu.au
Tue Sep 16 21:58:04 EDT 2014
On 17/09/2014 11:40 am, "Ray" <ray at linkit.com> wrote:
>Fantastic! Setting LockLoc to false did the trick. I wonder why
>lockLoc set to false creates this pulsing effect (the image is actually
>getting smaller and returning to its original size) in the first place.
With the image selected, try setting different angles using the property
inspector and you¹ll see that the rect of the image changes (grows) quite
a bit. If you constrain the rect by setting its lockLoc to true then you
are actually reducing the image¹s size when the angle isn¹t 0 or 180
degrees (or 90 or 270 if it¹s of equal width and height).
TerryŠ
>
>Anyway, problem solved.
>
>And Alejandro, many thanks for sharing the code which I think I may have
>some use for in another way.
>
>Many 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-Ma
>>ss-td4273701.html
>>
>>
>>
>>
>> --
>> View this message in context:
>>http://runtime-revolution.278305.n4.nabble.com/Missing-dragData-image-tp4
>>683313p4683321.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
>
>
>_______________________________________________
>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