Is there a way to Tilt and resize an SVG Widget by script V / H ?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Is there a way to Tilt and resize an SVG Widget by script V / H ?
Said it all in the Title !
1)
How does one Tilt at a 90deg angle an SVG widget through a script...
In order to display it on a stack from an horizontal position to a vertical position ?
...or there is no way in LC to do that with this widget in particular ?
2)
Can one resize down or up... by a few pixels or by a % an SVG Widget so that at the end it does display bigger/smaller on the Card ?
Thanks for any info...
1)
How does one Tilt at a 90deg angle an SVG widget through a script...
In order to display it on a stack from an horizontal position to a vertical position ?
...or there is no way in LC to do that with this widget in particular ?
2)
Can one resize down or up... by a few pixels or by a % an SVG Widget so that at the end it does display bigger/smaller on the Card ?
Thanks for any info...
Re: Is there a way to Tilt and resize an SVG Widget by script V / H ?
You can set any property an object has to anything you want to that is a known quantity.
So, angle that you asked about, possibly the easiest of all -
Sizing up (the graphic is merely there to set a boundary), percentages would be done by multiplication, pixels would be by whatever integer you use for the number of pixels using addition -
Sizing down, percentages would be done by division, pixels would be by whatever integer you use for the number of pixels using subtraction -
So, angle that you asked about, possibly the easiest of all -
Code: Select all
on mouseUp
set the angle of widget "Icon" to the angle of widget "Icon" +90
// rotates clock wise, use -90 to rotate counter clock wise
end mouseUp
Code: Select all
on mouseUp
if the width of widget "Icon" >= the width of graphic "Rectangle" then exit to top
set the height of widget "Icon" to the height of widget "Icon" *1.5
set the width of of widget "Icon" to the width of of widget "Icon" *1.5
end mouseUp
Code: Select all
on mouseUp
set the height of widget "Icon" to the height of widget "Icon" /1.5
set the width of of widget "Icon" to the width of of widget "Icon" /1.5
end mouseUp
-
- Livecode Opensource Backer
- Posts: 9476
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Is there a way to Tilt and resize an SVG Widget by script V / H ?
I'm not sure what you mean by "Tilt".
Rotation and altering either vertical or horizontal height is relatively easy.
I would like to know if there is a way to Skew an SVG (or any other image, for that matter) within LiveCode:
Rotation and altering either vertical or horizontal height is relatively easy.
I would like to know if there is a way to Skew an SVG (or any other image, for that matter) within LiveCode:
Re: Is there a way to Tilt and resize an SVG Widget by script V / H ?
LOL, thank you for posting Richmond, it showed me I had forgotten to attach the stupid demo stack ha ha ha.
The first is easy as well, the second might require a bit more thought (but I am pretty sure it could be done).
I agree, all those things (rotation, height/width) are easy to do. When you say 'skew', are we talking about just changing its proportions? Or do you mean 'skew' in the more literal sense, where the proportions change *and* the bottom is not in alignment with the top? The first is easy as well, the second might require a bit more thought (but I am pretty sure it could be done).
-
- Livecode Opensource Backer
- Posts: 9476
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Is there a way to Tilt and resize an SVG Widget by script V / H ?
By "skew" I mean what in GIMP is called "shear".
Re: Is there a way to Tilt and resize an SVG Widget by script V / H ?
Yah, that is the second one. I haven't looked into it, but as I say I am sure it could be done.
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Is there a way to Tilt and resize an SVG Widget by script V / H ?
@Richmond
For skewing a widget path you can use my SVG_Text widget (LC 8 only) installable via "[hh]-widgets-un-installer" from "Sample stacks". Now
[tab 2 of the property inspector]
set the svgTextPath to <iconPath>
set the inputPathInstructions to true
[tab 1 of the property inspector]
set the resizeProportional to true
set the pathAngleX to <angle> (= skewX)
set the pathAngleY to <angle> (= skewY)
You can copy and paste the <iconPath> from an svg icon-widget and use the property inspector for the above. Just a few clicks and moving sliders.
For skewing any image you can use my stack "Perspective Image Distortion" from "Sample stacks".
Start with an (imported) image. Then simply skew the control polygon for that, use the RelativePoints there. For example
SkewX (horizontal coords of the edges change equally, vertical coords remain constant)
add 100 to item 1 of line 1 and add 100 to item 1 of line 2, hit enter
SkewY (vertical coords of the edges change equally, horizontal coords remain constant)
add 100 to item 2 of line 2 and add 100 to item 2 of line 3, hit enter
I'll publish soon the demo stack I used for my LCGlobal talk in Nov 2017 about perspective and affine transforms of images and graphics. It can do much more.
For skewing a widget path you can use my SVG_Text widget (LC 8 only) installable via "[hh]-widgets-un-installer" from "Sample stacks". Now
[tab 2 of the property inspector]
set the svgTextPath to <iconPath>
set the inputPathInstructions to true
[tab 1 of the property inspector]
set the resizeProportional to true
set the pathAngleX to <angle> (= skewX)
set the pathAngleY to <angle> (= skewY)
You can copy and paste the <iconPath> from an svg icon-widget and use the property inspector for the above. Just a few clicks and moving sliders.
For skewing any image you can use my stack "Perspective Image Distortion" from "Sample stacks".
Start with an (imported) image. Then simply skew the control polygon for that, use the RelativePoints there. For example
SkewX (horizontal coords of the edges change equally, vertical coords remain constant)
add 100 to item 1 of line 1 and add 100 to item 1 of line 2, hit enter
SkewY (vertical coords of the edges change equally, horizontal coords remain constant)
add 100 to item 2 of line 2 and add 100 to item 2 of line 3, hit enter
I'll publish soon the demo stack I used for my LCGlobal talk in Nov 2017 about perspective and affine transforms of images and graphics. It can do much more.
shiftLock happens
Re: Is there a way to Tilt and resize an SVG Widget by script V / H ?
Thanks guys - I think thats all I needed is the angle +90 ..way to do it.
Its just a visual animation on screen, not a file modification process I needed.
I really start to like LC very much for the simplicity of its language !
so many stuffs can be done in such an easy way
Tks
Its just a visual animation on screen, not a file modification process I needed.
I really start to like LC very much for the simplicity of its language !
so many stuffs can be done in such an easy way
Tks
Re: Is there a way to Tilt and resize an SVG Widget by script V / H ?
BTW thanks for the Stack !
..thats exactly the type of rotation I was looking for!!
..thats exactly the type of rotation I was looking for!!
Re: Is there a way to Tilt and resize an SVG Widget by script V / H ?
Your very welcome