How to rotate a graphic

Jan Schenkel janschenkel at yahoo.com
Sat Nov 14 13:21:18 EST 2009


Of course, it was a bit lazy to just tell you to read the dictionary, but I was hungry and dinner was just ready ;-)
Now, what I usually do is draw the rectangle (or roundrect, or oval,...) and then use the Gradient panel to select the gradient type and quickly set the colors; then I use this helper command to finish those linear gradients off for me:
##
command FinishLinearGradient pGraphic, pDirection
   local tGradientA, tLocation, tRectangle
   local tFrom, tTo, tVia
   --
   put the fillGradient of pGraphic into tGradientA
   put the location of pGraphic into tLocation
   put the rectangle of pGraphic into tRectangle
   if pDirection is "Vertical" then
      put (item 1 of tLocation),(item 2 of tRectangle) into tFrom
      put (item 1 of tLocation),(item 4 of tRectangle) into tTo
      put (item 1 of tRectangle),(item 2 of tRectangle) into tVia
   else
      put (item 1 of tRectangle),(item 2 of tLocation) into tFrom
      put (item 3 of tRectangle),(item 2 of tLocation) into tTo
      put (item 1 of tRectangle),(item 4 of tRectangle) into tVia
   end if
   put tFrom into tGradientA["from"]
   put tTo into tGradientA["to"]
   put tVia into tGradientA["via"]
   set the fillGradient of pGraphic to tGradientA
end FinishLinearGradient
##
I put it into a helper plugin that's loaded at startup; and then I can just type into the message box:
##
FinishLinearGradient the selectedObject, "vertical"
##
And everything is set correctly without fiddling with the controls...

HTH,

Jan Schenkel
=====
Quartam Reports & PDF Library for Revolution
<http://www.quartam.com>

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)


--- On Sat, 11/14/09, Jan Schenkel <janschenkel at yahoo.com> wrote:

> From: Jan Schenkel <janschenkel at yahoo.com>
> Subject: Re: How to rotate a graphic
> To: "How to use Revolution" <use-revolution at lists.runrev.com>
> Date: Saturday, November 14, 2009, 8:45 AM
> Hi Claus,
> 
> Take a look at the 'fillGradient' property in the
> Dictionary. It is an array of different properties of the
> gradient which fills your graphic.
> Of particular interest are the 'from', 'to and 'via'
> sub-properties, as these designate where the gradient starts
> and ends, and at what angle.
> 
> You can also rotate the gradient interactively using the
> round selection points that show up when you switch to the
> Gradient panel in the Inspector palette.
> 
> HTH,
> 
> Jan Schenkel
> =====
> Quartam Reports & PDF Library for Revolution
> <http://www.quartam.com>
> 
> =====
> "As we grow older, we grow both wiser and more foolish at
> the same time."  (La Rochefoucauld)
> 
> 
> --- On Sat, 11/14/09, Claus Dreischer <claus at dreischer.de>
> wrote:
> > Hi,
> > 
> > there must be a realy obvious solution, but i can't
> see it
> > :-/
> > 
> > I put a gradient on a graphic (type rectangle).
> > This gradient is from left to right.
> > 
> > Now i just want to turn it by 90 degrees, so that my
> > gradient is from
> > top to bottom.
> > 
> > Dictionary gives my "rotate" and "angle", but both
> won't do
> > the trick.
> > 
> > So, how do i get a gradient from top to bottom?
> > 
> > Regards,
> >     Claus.
> > 


      



More information about the use-livecode mailing list