A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: How to reflect a movie clip across an angled line?

  1. #1

    How to reflect a movie clip across an angled line?

    I'm trying to build a tool similar to this.

    I'm using movie clips for the shapes.

    I am placing the reflected shape by figuring out the point on the line perpendicular to the original shape's registration point, then using the distance and angle. The part I'm stuck on is how to actually reflect it.

    It seems that if I was just drawing a shape I could use each point to determine new ones as I did above and redraw it, but I also have to reflect more irregular movie clips like illustrations and bitmaps. I tried rotating and flipping the shape on the x axis, y axis and both, but nothing really works correctly.

    Any insights on the best way to approach this? Is there a way to use a matrix?

    I'm stuck using AS2, but if whatever method I need to use is only available in AS3 I can push the client to use it. I code in both.

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    I'd probably use a bitmapdata, and draw in with a matrix that inverts either x or y and then does rotation and translation as needed. I don't know if you can do that in AS2.

  3. #3
    Thanks for the insight! Just before I read this I tried flipping on the x-axis only and using rotation and it seems to be working. I had a problem with the rotation when the object and its reflection clip were exactly on top of each other (zero distance was breaking the rotation calculation), but I fixed by using the virtual point in the distance I used to calculate the perpendicular.

    I've only dabbled in using matrix, but it has to be easier than doing all the math on my own like I am right now... although it is nice to know how to do it.
    Last edited by sirzooass; 04-07-2011 at 04:52 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center