I have been messing around with Scratch . . .
I notice that all the pre-supplied 'sprites' are SVG files . . .
Within Scratch these SVG images can be rotated any which way one wants with no visible deterioration at all.
As the only ways one can import a vector image into LiveCode is either via the SVG widget or
by setting the points of a graphic object to the points of an SVG image there seems to be
NO way one can rotate them.
rotating SVG images
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: rotating SVG images
For rotating the points of a polygon in LC Script use the following.
For rotating a deliberate imported SVG use in LC Builder
(there are several lcb files that show how to "prepare" for rotation)
Code: Select all
-- b is the angle of rotation in degrees (positive b turns clockwise, negative b turns ccw)
-- pts are the points of a polygon and (x0,y0) is the center of rotation
function hhRotateTo b,pts,x0,y0
put sin(pi*b/180) into s; put cos(pi*b/180) into c
repeat for each line L in pts
if L is empty then put cr after pts2
else
put -x0 + item 1 of L into sx; put -y0 + item 2 of L into sy
put cr & ( (statRound(x0+c*sx-s*sy),statRound(y0+c*sy+s*sx)) ) after pts2
end if
end repeat
return char 2 to -1 of pts2
end hhRotateTo
(there are several lcb files that show how to "prepare" for rotation)
Code: Select all
rotate this canvas by <angle> OR rotate <path> by <angle>
shiftLock happens
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: rotating SVG images
Thank you.
Although, compared with rotating PNG, GIF and JPG images this does seem a bit complicated.
Although, compared with rotating PNG, GIF and JPG images this does seem a bit complicated.