Archive for the ‘ActionScript 3’ Category
3D dice with rounded edges
This is a 3D dice I made in FIVe3D. It has rounded edges that animates with rotation to the next score.
A couple of weeks ago I had to add a dice for a game my colleague was developing. Scanning the net did not give any satisfactory results so I set off to make it myself. As I knew there will be vectors only I chose to use this task to check out FIVe3D. After dropping the idea to implement real physics I made the first static dice rather fast - just a cube with 6 faces and circles on them. The sharp corners just did not fit the the design requirements. So in a dirty way I squeezed in some extra rectangles and triangles between the 6 faces of the cube what made the corners appear rounded. For the outlines see the image on the side. Sadly this broke the shadows being drawn correctly; I tried to overcome this problem but did not succeed (but maybe someone else wants to try it out).
The dice is easily customizable. You can change it’s size, view angle and light effects. The dice’s roll() method accepts a previously chosen target value, but can generate it on random. An event is dispatched after the roll animation has completed. It has a slightly different animation depending on mouse position.
View the example and download project source. Let me know if you find it useful.
Version 2 of Tree generator in 25 lines of ActionScript
January 2009 finalists of the 25-Line ActionScript Contest have been announced and sadly my entry is not among them. Therefore, to fulfill my desire of sharing I present you Tree generator 2. And for my fellow coders here is the source. Just a small tip – click on the stage to start a new tree.
This time it is more math than flash – the tree is drawn by generating 3D vectors (with critical parameters of rotationY, rotationZ, length) for branches and changing them accordingly to their age and their parent branch position.
Tree generator in 25 lines of ActionScript
I am writing a bit late, but just wanted to share that I as well had submited my entry for the The 25-Line ActionScript Contest – Tree Generator. For those not yet informed the competition is a revamp of the 2000 Flash MX 6 ActionScript 1 version, made alive by Keith Peters. on time with the release of Flash CS4. It is planned as a regular contest with cool prizes, starting with Adobe CS4 Suite.
Flash has changed a lot during the years and some folks are complaining that AS has become harder, too verbose, and that it takes more code to do the same things compared to AS1. I see this competition as a part of Keith Peters’ initiative to put the Flash Back in Flash.
As I am always amazed by the fields where technology touches the real world, I wanted to build something connected to nature. I know that other have already made really nice trees, but I saw some space for optimisation – sorry, Grant, but trees don’t grow that way. So, I made a growth animation, from a small culm to a full-grown tree only in 25 lines. I did not made it into the top 12, but I still want to share. Take a look at the code and swf and see the November/December Finalists.



