Re: [Flashcoders] AS3: Stretch only edges of a displayObject?I

2008-05-20 Thread Rich Shupe
Eric, I know this isn't the root of what you were asking, but here's a class
by Thibault Imbert that brings 9-slice scaling to bitmaps. Not on point, but
related:

http://www.bytearray.org/?p=118

And if anyone is interested, donate to his book. And if there are any fluent
French speakers willing to contribute translation efforts, let me know.

Rich
http://www.LearningActionScript3.com


___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3: Stretch only edges of a displayObject?I

2008-05-20 Thread eric e. dolecki
crud. anyone remember how to load a filter? ;)

On Tue, May 20, 2008 at 2:27 PM, Rich Shupe <[EMAIL PROTECTED]> wrote:

> You can almost certainly write a Hydra filter for this. You can do it
> AS-native with BitmapData.
>
> 9-slice scaling can't do what you're hoping for, as I understand it. It
> will
> only scale the top and bottom "centers" when scaling left and right, the
> left and right "centers" when scaling up and down, the center slice in all
> cases, and never the corners.
>
> If you want something *very* roughly like the genie effect (where the top
> and bottom scale but not the middle, or vice-versa), you'll need to write
> something for that. There are bunch of examples like this if you want to
> think a bit about what to search for. I can think of the genie effect, an
> old-school waving flag or skew, etc., all of which cut the object into
> slices and manipulate them individually.
>
> In fact, this is required when using 9-slice on a bitmap. You have to cut
> the BM along the lines of the scale-9 rect so the auto scaling will work
> properly. (You can do it manually before importing, too, but that's
> obviously not dynamic.)
>
> Another thing that was quite popular was the slice-distortion of a single
> image--the first I saw was the Mona Lisa--depending on where you hovered
> your mouse. I just did a search for "mona lisa actionscript" with no luck,
> but this might jog some gray cells into action.
>
> You might also look for an ActionScript goo/liquify example which would
> demonstrate a displacement map approach. I think Grant did one of Mike
> Chambers.
>
> I'll try to pull this into focus when I have a clearer head and maybe I can
> think of a concrete link or two.
>
> R
>
>
> On 5/20/08 1:35 PM, "eric e. dolecki" <[EMAIL PROTECTED]> wrote:
>
> > While I don't seem to be able to do this easily, I am applying scale9grid
> to
> > sorta do what I want. I was hoping for incremental stretching on the
> > sides... maybe that is something I'll be able to do using a hydra filter
> or
> > something in FP10.
>
> Rich
> http://www.LearningActionScript3.com
>
>
> ___
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3: Stretch only edges of a displayObject?I

2008-05-20 Thread Rich Shupe
You can almost certainly write a Hydra filter for this. You can do it
AS-native with BitmapData.

9-slice scaling can't do what you're hoping for, as I understand it. It will
only scale the top and bottom "centers" when scaling left and right, the
left and right "centers" when scaling up and down, the center slice in all
cases, and never the corners.

If you want something *very* roughly like the genie effect (where the top
and bottom scale but not the middle, or vice-versa), you'll need to write
something for that. There are bunch of examples like this if you want to
think a bit about what to search for. I can think of the genie effect, an
old-school waving flag or skew, etc., all of which cut the object into
slices and manipulate them individually.

In fact, this is required when using 9-slice on a bitmap. You have to cut
the BM along the lines of the scale-9 rect so the auto scaling will work
properly. (You can do it manually before importing, too, but that's
obviously not dynamic.)

Another thing that was quite popular was the slice-distortion of a single
image--the first I saw was the Mona Lisa--depending on where you hovered
your mouse. I just did a search for "mona lisa actionscript" with no luck,
but this might jog some gray cells into action.

You might also look for an ActionScript goo/liquify example which would
demonstrate a displacement map approach. I think Grant did one of Mike
Chambers. 

I'll try to pull this into focus when I have a clearer head and maybe I can
think of a concrete link or two.

R


On 5/20/08 1:35 PM, "eric e. dolecki" <[EMAIL PROTECTED]> wrote:

> While I don't seem to be able to do this easily, I am applying scale9grid to
> sorta do what I want. I was hoping for incremental stretching on the
> sides... maybe that is something I'll be able to do using a hydra filter or
> something in FP10.

Rich
http://www.LearningActionScript3.com


___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3: Stretch only edges of a displayObject?I

2008-05-20 Thread eric e. dolecki
That was going to be an approach... and I would apply the "stretch" to the
sides loaded in on top by hand in Photoshop (cementing the effect -- bad
voodoo there). Then I thought it might be cool to do it using the BitmapData
class somehow instead so I didn't need to worry about any cleanup, etc. as
much as the image will be changing a lot, etc. I'm investigating Pixel
Bender right now.

On Tue, May 20, 2008 at 1:48 PM, Steven Sacks <[EMAIL PROTECTED]>
wrote:

> Maybe this will work?
>
> Make two copies of the original MovieClip (if you're loading an image, load
> it once into the first clip, then when it's done loading, load it into the
> two others) for a total of three.
>
> Mask the left and right pieces to the width you want to show.   Mask the
> middle piece so those edges aren't showing.
>
> Determine the math that you would have to stretch each one of the slices so
> that that portion would be stretched 15% (it will be more than 15% because
> you would have to take into account the width of the entire clip) and set
> their scalex to that value.
>
> Position their x so they're lined up correctly.
>
> Voila!
>
>
> eric e. dolecki wrote:
>
>> I am looking to take a DO (movieclip), and stretch just the side edges,
>> leaving the middle unstretched... so take an image, cut in 4 vertical
>> pieces, and stretch the outside pieces out horizontally by like 15%.
>>
>> I could use DisplayObjects above the main one and just stretch those
>> horizontally, but I really want to keep this contained to manipulations on
>> the main object itself and not worry about creating and destroying others.
>>
>> Any ideas?
>> ___
>> Flashcoders mailing list
>> [email protected]
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>>
>>
>
> ___
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3: Stretch only edges of a displayObject?I

2008-05-20 Thread Steven Sacks

Maybe this will work?

Make two copies of the original MovieClip (if you're loading an image, 
load it once into the first clip, then when it's done loading, load it 
into the two others) for a total of three.


Mask the left and right pieces to the width you want to show.   Mask the 
middle piece so those edges aren't showing.


Determine the math that you would have to stretch each one of the slices 
so that that portion would be stretched 15% (it will be more than 15% 
because you would have to take into account the width of the entire 
clip) and set their scalex to that value.


Position their x so they're lined up correctly.

Voila!


eric e. dolecki wrote:

I am looking to take a DO (movieclip), and stretch just the side edges,
leaving the middle unstretched... so take an image, cut in 4 vertical
pieces, and stretch the outside pieces out horizontally by like 15%.

I could use DisplayObjects above the main one and just stretch those
horizontally, but I really want to keep this contained to manipulations on
the main object itself and not worry about creating and destroying others.

Any ideas?
___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

  


___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3: Stretch only edges of a displayObject?I

2008-05-20 Thread eric e. dolecki
While I don't seem to be able to do this easily, I am applying scale9grid to
sorta do what I want. I was hoping for incremental stretching on the
sides... maybe that is something I'll be able to do using a hydra filter or
something in FP10.


On Tue, May 20, 2008 at 12:47 PM, Rich Shupe <[EMAIL PROTECTED]> wrote:

> Eric, if you're saying you want to manipulate the first and last 15% of a
> display object without creating anything else, I don't think that's
> possible. The closest I can think of that will accomplish that is using a
> displacement map filter in conjunction with resizing. That might get you
> what you need, but you'll still have to create the displacement map.
>
> Another way to do this is to create and destroy other objects but within
> the
> main object. At least that way you won't have to worry about moving,
> rotating, etc., four slices. You could use BitmapData, for example, create
> the four slices and add them inside the same do, allowing you to manipulate
> only slices 1 and 4, but still treat the entire d.o. as a single entity.
>
>
> On 5/20/08 9:44 AM, "eric e. dolecki" wrote:
>
> > I am looking to take a DO (movieclip), and stretch just the side edges,
> > leaving the middle unstretched... so take an image, cut in 4 vertical
> > pieces, and stretch the outside pieces out horizontally by like 15%.
> >
> > I could use DisplayObjects above the main one and just stretch those
> > horizontally, but I really want to keep this contained to manipulations
> on
> > the main object itself and not worry about creating and destroying
> others.
>
> Rich
> http://www.LearningActionScript3.com
>
>
> ___
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3: Stretch only edges of a displayObject?I

2008-05-20 Thread Rich Shupe
Eric, if you're saying you want to manipulate the first and last 15% of a
display object without creating anything else, I don't think that's
possible. The closest I can think of that will accomplish that is using a
displacement map filter in conjunction with resizing. That might get you
what you need, but you'll still have to create the displacement map.

Another way to do this is to create and destroy other objects but within the
main object. At least that way you won't have to worry about moving,
rotating, etc., four slices. You could use BitmapData, for example, create
the four slices and add them inside the same do, allowing you to manipulate
only slices 1 and 4, but still treat the entire d.o. as a single entity.


On 5/20/08 9:44 AM, "eric e. dolecki" wrote:

> I am looking to take a DO (movieclip), and stretch just the side edges,
> leaving the middle unstretched... so take an image, cut in 4 vertical
> pieces, and stretch the outside pieces out horizontally by like 15%.
> 
> I could use DisplayObjects above the main one and just stretch those
> horizontally, but I really want to keep this contained to manipulations on
> the main object itself and not worry about creating and destroying others.

Rich
http://www.LearningActionScript3.com


___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders