Page 1 of 1

Rotate 3 graphics as group

Posted: Wed Jun 01, 2016 12:57 pm
by joran
Hi

Is it possible to rotate a group?
I'm having 3 graphic object joined together as one, but I can't figure out how to make the group (of graphic objects) to rotate.

// Joran

Re: Rotate 3 graphics as group

Posted: Wed Jun 01, 2016 1:00 pm
by Klaus
Hi Joran,
joran wrote:Is it possible to rotate a group?
unfortunately no!

But you could take a screenshot of your group and rotate that image, if that is an option?


Best

Klaus

Re: Rotate 3 graphics as group

Posted: Wed Jun 01, 2016 1:08 pm
by joran
Ok, thought it might be so.

Thanks anyway :-)

Re: Rotate 3 graphics as group

Posted: Wed Jun 01, 2016 2:56 pm
by dunbarx
Might this be a useful new feature to ask for?

Craig Newman

Re: Rotate 3 graphics as group

Posted: Sun Jun 05, 2016 8:35 pm
by Fermin
... and also be great rotate a FIELD (with text, of course)

Re: Rotate 3 graphics as group

Posted: Sun Jun 05, 2016 8:49 pm
by richmond62
Currently one can only do a 'set the angle' or a 'rotate' with an image.

Re: Rotate 3 graphics as group

Posted: Sun Jun 05, 2016 8:49 pm
by [-hh]
It is possible to rotate a group, that containes "rotatable" objects (images, graphics).

Requires some scripting, not too hard.
For example look into Malte's Animation Engine, which is available on github now:
https://github.com/derbrill/animationEngine
There is code for groups containing graphics that you can use also for images (alike rectangle graphics).

It's not the same as rotating each object in the group by the same angle, but you'll get nice 'unusual' effects with the latter.

Re: Rotate 3 graphics as group

Posted: Sun Jun 05, 2016 8:58 pm
by richmond62
Probably not that difficult to ungroup the group, rotate the objects round a point, and then regroup them.

??? http://forums.livecode.com/viewtopic.ph ... 793#p21326

Re: Rotate 3 graphics as group

Posted: Sun Jun 05, 2016 9:05 pm
by richmond62
Hey: why slave away to do something that somebody has already done?

http://lists.runrev.com/pipermail/use-l ... 66416.html


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

Re: Rotate 3 graphics as group

Posted: Sun Jun 05, 2016 10:29 pm
by bn
@Fermin,
... and also be great rotate a FIELD (with text, of course)
not a whole field but text nevertheless:

http://forums.livecode.com/viewtopic.ph ... it=+rotate
2 stacks to show how to rotate text using a snapshot of the text.



Here rotate text (one line) horizontally as a widget i.e. use LC 8.0 and above:
http://runtime-revolution.278305.n4.nab ... 05279.html

Kind regards
Bernd

Re: Rotate 3 graphics as group

Posted: Mon Jun 06, 2016 2:47 pm
by Fermin
Thank you very much, Bernd for your advice and links.

Yes, I'm afraid the method to rotate text is related to the snapshot of fields with the text and then manipulate the images. Well, it's going to be hard work because I am working on an application to help me to build video lyrics (an image for each line of text ... and even for every word!)

but... I'm not giving up. We'll see.

:-)

Re: Rotate 3 graphics as group

Posted: Thu Jun 09, 2016 4:29 pm
by MaxV
To do this (rotating object at once), video: https://www.youtube.com/watch?v=lG2Kavvqnyc

this is the code:

########CODE#######
on ruotafigura
if the label of me is "START" then
exit ruotafigura
end if
put the thumbpos of scrollbar "angolo" into Dangolo
lock screen
put the angle of graphic 1 into curangolo
put dangolo + curangolo into curangolo
set the angle of graphic 1 to curangolo
set the angle of graphic 2 to curangolo
#loc = 152,118
#w x h = 100,100
set the loc of graphic 2 to (152 + 100 * cos(pi/180 * curangolo), 118 + 100 * sin(pi/180 * curangolo) )
unlock screen
send ruotafigura to me in 0.017 sec #non ha senso scendere sotto questo valore
end ruotafigura
#####END OF CODE#####

Re: Rotate 3 graphics as group

Posted: Thu Jun 09, 2016 4:37 pm
by MaxV
to rotate text use livecode 8 and the SVG widget, set the the iconPath property to the path to render the letter. This widget has rotation.
You can use inkscape to create the letters path and livecode add paths one after another.
https://inkscape.org

Code: Select all

inkscape file_text.svg --export-text-to-path --export-plain-svg file_shapes.svg
Or convert directly a font file with http://xmlgraphics.apache.org/batik/too ... erter.html

Re: Rotate 3 graphics as group

Posted: Sat Sep 01, 2018 11:40 am
by richmond62
The following three basic rotation matrices
You seem to have forgotten to include the matrices.