AS3 Fragmentation Class Tutorial Pt. 1
Hello.
To create this nice fragmentation effect like the one from Andy Foulds`s homepage, i have written this little AS3 Class. The first part of the tutorial will mainly focus on how to get this effect running. The second part shows a way to get an arbitrary DisplayObject onto the fragmentation layer to create a cooler transition effect.
| The example code uses a DocumentClass wich is just executed by “FragmentExample.fla”. So don´t be confused if you do not find any AS3 in the *.fla file. |
To start the effect from Flash you have to follow these steps:
1. Import Packages:
1 | import de.ehrhardt.fragment.*; |
2. Create new fragmentation layer:
2 3 4 5 6 7 8 9 10 11 | var rectSize:int = 10; var updateRate:int = 30; var fxDirection:String = "left"; var bgColor:int = 0xCCCCCC; var borderColor:int = 0xCCCCCC; var borderSize:Number = 0.2; var startNow:Boolean = true; var fragLayer:FragmentLayer = new FragmentLayer (your_mc, rectSize, updateRate, fxDirection, bgColor, borderColor, borderSize, startNow); |
3. Define RectSize:
13 | your_mc |
…should be replaced from your DisplyObject´s instance name. You have to take care that the dimension
s of the object are mapped exactly, because this feature is not introduced here. E.g. a MC with dimension of 220×110 pixels should have rectSize = 10 because of incorrect covering.
4. Set Frame Rate:
More than 25 Frames per second are recommended for proper animations. You find it in Flash under the designation “Properties”.
(optional:)
5. Manual effect start, e.g. after a MouseClick Event:
14 15 16 17 18 19 20 | your_mc.addEventListener (MouseEvent.CLICK, clickActionHandler); function clickActionHandler (e:Event):void { fragLayer.startEffect(); e.target.removeEventListener(MouseEvent.CLICK, clickActionHandler); } |
In addition you have to set the variable startNow to “false” :
21 | var startNow:Boolean = false; |
Done.
We have finished the first part. How to put an image onto the Fragmentation-Layer to create a nicer transition, i´ll show in the next part.
2 Comments to AS3 Fragmentation Class Tutorial Pt. 1
[...] english version [...]
cooler Post!
Leave a comment
Search
TAG CLOUD
WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.
RECENT ARTICLES
- DJ Olive – Let Us Live Mix
- Demo by Holon – Noodlesoup
- Stuff & Things
- ByteFM – Quality Radio Channel
- Beardyman at Glastonbury 2010
- Happy Meal Project
- Little big Berlin
- Gilles Peterson Summer Jazz Mix
- Illustrations by ZSO
- Multi Touch Light Table by Gergwerk
- Dalton Ghetti’s micro pencil art
- Words by Everynone
FRIENDS
Categories
- 3D (11)
- Advertising (11)
- Animation (68)
- Art (92)
- Data Visualization (12)
- Film (52)
- Fun (37)
- Graphic Design (39)
- Illustration (33)
- Links (27)
- Linux (4)
- Logo Design (2)
- Motion Design (45)
- Music (123)
- Photography (28)
- Physical computing (7)
- Programming (8)
- Random (22)
- Street Art (17)
- Tutorials (8)
- Typography (15)
- Vector Art (3)
- Web (47)
Archive
- September 2010 (2)
- August 2010 (14)
- July 2010 (14)
- June 2010 (12)
- May 2010 (10)
- April 2010 (8)
- March 2010 (16)
- February 2010 (11)
- January 2010 (11)
- December 2009 (11)
- November 2009 (11)
- October 2009 (19)
- September 2009 (16)
- August 2009 (10)
- July 2009 (20)
- June 2009 (14)
- May 2009 (24)
- April 2009 (32)
- March 2009 (26)
- February 2009 (15)
- January 2009 (15)
- December 2008 (7)
- November 2008 (8)
- October 2008 (5)
- September 2008 (11)
- August 2008 (7)
- July 2008 (8)

2008/12/17