How to rotate a graphic

11 messages Options
Embed this post
Permalink
Claus Dreischer

How to rotate a graphic

Reply Threaded More More options
Print post
Permalink
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.
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Jan Schenkel

Re: How to rotate a graphic

Reply Threaded More More options
Print post
Permalink
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 <[hidden email]> 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.
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage
> your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Mark Wieder

Re: How to rotate a graphic

Reply Threaded More More options
Print post
Permalink
Claus-

Saturday, November 14, 2009, 8:45:18 AM, Jan wrote:

> 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.

...and nonintuitively, the "from" element is the center of rotation.
Here's a simple routine to turn the graphic gradient clockwise from
horizontal to vertical.

on mouseUp pMouseBtnNo
    local tGradient
    local tFrom, tTo, tVia
    local tLength
   
    put the fillgradient of graphic 1 into tGradient
    put tGradient["from"] into tFrom
    put tGradient["to"] into tTo
    put tGradient["via"] into tVia
   
    -- "from" is the fulcrum : we want to rotate around it

    set the itemdelimiter to comma
    put item 1 of tTo - item 1 of tFrom into tLength
    put item 1 of tFrom into item 1 of tTo
    put item 2 of tFrom + tLength into item 2 of tTo
   
    put item 2 of tVia- item 2 of tFrom into tLength
    put item 2 of tFrom into item 2 of tVia
    put item 1 of tFrom - tLength into item 1 of tVia
   
    put tFrom into tGradient["from"]
    put tTo into tGradient["to"]
    put tVia into tGradient["via"]
    set the fillgradient of graphic 1 to tGradient
end mouseUp

--
-Mark Wieder
 [hidden email]

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Colin Holgate-2

Re: How to rotate a graphic

Reply Threaded More More options
Print post
Permalink
In reply to this post by Jan Schenkel

On Nov 14, 2009, at 11:45 AM, Jan Schenkel wrote:

> >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.


While that is all useful to know, what is the reason that the rectangle itself doesn't rotate? You can set the loc of a graphic, and that works, and you can set the angle of the graphic, and put it to see that it's changed, but the graphic hasn't rotated.




_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Jan Schenkel

Re: How to rotate a graphic

Reply Threaded More More options
Print post
Permalink
The 'angle' property is only applicable to graphics of type 'oval' - it is actually a synonym for the 'startAngle' property, which along with the 'arcAngle'property, allows you to make segments of an oval, rather than a full oval.

It would be great if the RunRev team could give us any type of affine transformation, as is possible with Java2D graphics. They allow you to apply translation, rotation, stretching, skewing, etc. to anything you 'draw' in a Graphics2D object.
Think of what we could do with rotated fields, images and even movie players :-)

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, Colin Holgate <[hidden email]> wrote:
>
> While that is all useful to know, what is the reason that
> the rectangle itself doesn't rotate? You can set the loc of
> a graphic, and that works, and you can set the angle of the
> graphic, and put it to see that it's changed, but the
> graphic hasn't rotated.
>


     
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Scott Rossi

Re: How to rotate a graphic

Reply Threaded More More options
Print post
Permalink
In reply to this post by Colin Holgate-2
Recently, Colin Holgate wrote:

> what is the reason that the rectangle itself doesn't rotate? You can set the
> loc of a graphic, and that works, and you can set the angle of the graphic,
> and put it to see that it's changed, but the graphic hasn't rotated.

I'll guess the reason is because the graphic architecture is somewhat
outdated.  You *can* rotate a polygon graphic in degree increments (plus
there are math routines in the list archives that allow you to rotate a
polygon directly).  Tip: if you're going to do multiple rotations on a
polygon, it can be helpful to store the original points of the graphic to
keep it from distorting.

Even then, everything is based on whole pixel positions which makes for
somewhat coarse results when rotating (object will appear to bounce up and
down and get distorted).  There's been talk of getting Rev to use sub-pixel
positioning, but there's been no word on when this is going to happen.

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Jan Schenkel

Re: How to rotate a graphic

Reply Threaded More More options
Print post
Permalink
In reply to this post by Claus Dreischer
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 <[hidden email]> wrote:

> From: Jan Schenkel <[hidden email]>
> Subject: Re: How to rotate a graphic
> To: "How to use Revolution" <[hidden email]>
> 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 <[hidden email]>
> 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.
> >



_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Jim Sims

Re: How to rotate a graphic

Reply Threaded More More options
Print post
Permalink
In reply to this post by Jan Schenkel

On Nov 14, 2009, at 7:07 PM, Jan Schenkel wrote:
> It would be great if the RunRev team could give us any type of  
> affine transformation, as is possible with Java2D graphics. They  
> allow you to apply translation, rotation, stretching, skewing, etc.  
> to anything you 'draw' in a Graphics2D object.
> Think of what we could do with rotated fields, images and even movie  
> players :-)

Quite some time ago I made a demo using Trevor's quicktime external  
that rotated movie players   ;-)

Haven't used it in a while, but it is still included on Trevor's web  
site.

sims

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Scott Rossi

Re: How to rotate a graphic

Reply Threaded More More options
Print post
Permalink
In reply to this post by Claus Dreischer
Recently, Claus Dreischer wrote:

> So, how do i get a gradient from top to bottom?

<SHAMELESS PLUG>

If you're interested in managing gradients a bit more interactively, I have
a Revolution plugin called tm|gradient that allows you to control virtually
every gradient property, along with preset settings that you can
create/save:
http://www.tactilemedia.com

</SHAMELESS PLUG>

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Jan Schenkel

Re: How to rotate a graphic

Reply Threaded More More options
Print post
Permalink
In reply to this post by Jim Sims
Cool - but that's using an external ;-)

Another Java2D trick I've seen a few times is painting a reflection of an entire scene, including a running quicktime movie, below the scene. So it looks like you're watching something on tv, and see it bouncing off the table that's sitting in front of the tv.
A very nice effect which I don't see us replicating any time soon - but hey, I use rev for database stuff, so I wouldn't know where to begin...

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, Jim Sims <[hidden email]> wrote:

> From: Jim Sims <[hidden email]>
> Subject: Re: How to rotate a graphic
> To: "How to use Revolution" <[hidden email]>
> Date: Saturday, November 14, 2009, 10:22 AM
>
> On Nov 14, 2009, at 7:07 PM, Jan Schenkel wrote:
> > It would be great if the RunRev team could give us any
> type of affine transformation, as is possible with Java2D
> graphics. They allow you to apply translation, rotation,
> stretching, skewing, etc. to anything you 'draw' in a
> Graphics2D object.
> > Think of what we could do with rotated fields, images
> and even movie players :-)
>
> Quite some time ago I made a demo using Trevor's quicktime
> external that rotated movie players   ;-)
>
> Haven't used it in a while, but it is still included on
> Trevor's web site.
>
> sims
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage
> your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Claus Dreischer

Re: How to rotate a graphic

Reply Threaded More More options
Print post
Permalink
In reply to this post by Claus Dreischer
Ok,

this is really getting embarrassing ...

@Jan:
Yes, now i can somewhat understand what the dictionary tried to tell me.
(basic embarrassment i get quite a lot when trying something new)

Yes, "suddenly" there are some round selection points i can use to
interactively rotate the gradient.
(This embarrassment is rather unusual even for me, as i did wear my glasses)

@Scott:
(now this is a good one)
I now remember buying tm|gradient. But it was lost in one of the last
updates of revolution.
(This is a new record for me)


Thanks Jan and Scott for making my day ...








... a real special one ;-)


Claus.
(sitting in the shame corner)
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution