Women in Technology

Hear us Roar



Article:
  ActionScript for Non-Coders
Subject:   Additional AS Placement in the VCAM
Date:   2004-11-09 21:13:40
From:   eff-werks
Sham,


I wanted to say thanks for the update and I did send Macromedia my request in regards to the AS export for video issue. Now I have another problem. I'm looking over the AS for the VCAM and I'm essentially trying to create a fisheye look to the viewer using typical convex magnifications and or masking techniques. (The masking techniques work best on a static image. So it doesn't really work here.) What I'm really trying to do is figure out the best place within the VCAM AS to place a convex distortion to give me the desired effect. Any suggestions? I really appreciate it. Thanks.


Kevin

Full Threads Oldest First

Showing messages 1 through 3 of 3.

  • Additional AS Placement in the VCAM
    2004-11-10 09:36:51  Sham_B [View]

    Hi Kevin.

    As you probably already know, creating a true convex distortion is impossible in Flash, but it can be emulated. The first question is exactly how you would emulate it.

    A fisheye magnification is one with a high magnification at the center, and this falls off quickly the further you get from the center. You could emulate this by using a series of donut shaped masks, that build up to form a solid circle (NB - You would have to use hack 20 to create the donut masks, and the effect will become more realistic - and slower - the more donuts you use).

    You could make the magnification of the image seen through each mask inversly proportional to the _width of each masking donut shape, and that would give you your fisheye distortion (I would start by using something like k-thisMask._width, where k is a constant... Im not sure what it would be, but Im guessing it would be something of the order of the _width of the final fisheye or the _width of target (see below for what 'target' is).

    You could put this code anywhere in the vcam script, but that is not the real issue. The issue is that for the fisheye effect to work, you have to create multiple versions of the thing you are applying the fisheye effect to (in fact, you would have to duplicate once per donut).

    I think this effect is actually much closer to hack 36, and you would be much better off using that as a guide. In fact, having just looked at 36 (Panoramic images), what you want to do will be fundamentally *very* similar to that.

    finally, here's a summary of some points I quickly scribbled down when thinking about this effect...

    1. You cant create what you want as a simple drag and drop vcam that operates on _root (you cant duplicate _root for one thing). Instead, you would need to apply it to a movie clip which I will call 'target').
    2. The effect would work by using a series of donut masks applied to multiple versions of the target (which you would have to duplicate, one per donut).
    3. Each masked image would be in the same position, but would have to be scaled by an amount that is inversionally proportional to the _width of its mask. when you view all the seperate image 'donut slices' together, you will see the fisheye effect
    4. The effect would probably really slow down for anything except a static bitmap or static vector, and the effect will also look better the more donut slices you use.
    5. the panoramic hack does something very similar. I suspect you would use that code as a starting point, the major difference being that you will be changing the shape of the mask.
    6. An alternative way to do the effect would be to use vertical strips (as does hack 36) to get the fisheye distort effect in the x axis, then mask the result again with horizontal stips (to get the distortion in the y axis. I thought about doing it that way, but discarded it because I felt it would probably be too processor intensive.
    7. Athough the final effect will be processor intensive, the new Flash player (FP8) looks to be much faster than previous versions - see http://www.moock.org/blog/archives/000146.html - and seems to be geared to this kind of effect.

    Oh, and finally, I havent actually created this effect, but this is my best guess based on a quick look at it (I basically looked at it in the same way as I looked at hack 25 (deconstucting the page turning effect). I know a fisheye can be done because I have seen it (can't remember the URL, will post if it comes to me).

    HTH.

    S
    • fisheye emulation
      2004-12-29 20:12:35  mike9292 [View]

      For a quick fisheye simulation, see this tutorial:

      http://www.kirupa.com/developer/mx2004/liquify.htm

      it's written for flashers of all skill-levels but the code is solid and the basic technique is how to create a fisheye in flash.
    • Additional AS Placement in the VCAM
      2004-11-10 09:37:55  Sham_B [View]

      PS - sorry for all the spelling mistakes. I was writing as fast as I was thinking :)

      S