Source: mozi247
Taken with instagram
While I was developing and improving my framework, focused on the textfield stuff, I had an idea to create a multi column text class. It works pretty simple and you only have to set the number of columns and the margin between those columns. Very, very simple.
Hope you like it, you can get the source files and this example (and much more) on github project. Check it out.
This is a simple Sound Spectrum using the basic paths that I’ve created on my Distribute class. I will have to wait a little to load the music.
On the next post, I will show another experiment with sound spectrum and the Distribute class. It’s going to be something similar to the effect made for the FPM website.
By the way, the music is Time to Pretend from MGMT.
Hello world.
Again I decided to create a blog about Flash. But now I won’t focus only on technical stuff, this time I will talk a little more about animation and creativity, that are extremely important as well.
I will also talk a little more about my day by day, inspirations and some snippets from the projects that I’m working on.
This experiment above that I hope you are seeing, is from an idea that I had last week, when I was developing a sound spectrum for a personal project. The idea was to create different shapes and distribute some points/sprites on the path of this shape.
I started to search on the internet for some references I didn’t found too much about it, excepting a very good class from Senocular. And as I had time to work on it, I decided to build my own class from the scratch. This is good for practicing/learning and also because I could build something at my own taste.
First Step
The main idea was to create two classes. One to create a path, where I could get any point using a float number between 0 and 1. Where 0 would be the beginning and 1 would be the end of the path. And another class to distribute the display objects along this path.
So first of of all I’ve created a class named Path, where we can add new points to create this path. Now that we’ve those points, we also have segments. The segment is just an abstract line between the current point and the previous point. With this segment we can get the length of the path and the length of each segment.
With those informations, we just need to do a simple math equation to find out which segment contains the point that we need.
And now that we have the segment, we just have to find the final point between the two points of the segment.
This is the easiest part, because the Point class has a method called interpolate that does exactly what we need. So now we can get any point on our path using a number between 0 and 1.
Distributing the display objects
To distribute the children on this path I’ve created a class called Distribute, that has two public methods: distribute and orientToPath.
The distribute method will catch all your objects and divide them by the total of objects, to get a number between 0 and 1. With this number we just call the method getPointAt of our path to obtain the current position.
And the orientToPath will rotate our objects based on the next available position.
I’ve also created some default paths, like a rectangle, triangle, polygon, circle and star.
For example, if you want to distribute your children on a path of a star, check it out:
There’s some other extra features, like the MultiPath class where you can create multiple paths, in case you want to build something more complex.
If you are interested, you can get those classes and some examples at my github page.
On the next post I will post more examples of this class using some other interactions, like the sound spectrum.
Feel free to ask, suggest and give your opinion about subjects that I should talk about.
That’s it, thank you for reading! See you soon. I hope.
ps: I’m sorry for my bad english and for my bad explanation. I will improve it with time. :)
