Changes

Jump to navigation Jump to search
no edit summary
== More animated objects ==
Let's make things more interesting by adding more moving elements, says a lot of particles moving along several circles in a random fashion. If the positions of the animated objects are deterministic, such as a function of time (`{f(time)`) as shown in our first example, there is no difficulty in calculating the positions and drawing the object at these positions, something like:
<texcode>
On each circle ''c'' (`c=1,...,nbcircles`), we will define some objects ''o'' (`o=1,...,nbObjects[c]`) (called sometimes particles here), so the total number of objects is `O = nbObjects[1] + nbObjects[2]+...+nbObjects[nbcircles]`. Each object ''o'' on circle ''c'' will have at time ''t'' the position `Position[c][o][t]`. This position, express as a number in [0,1] is a coordinate along the path `ThePath[c]`. The position at time 1 is chosen randomly along the path ''c'' (line 13), and then will be calculated for each time ''t'' from the position at time ''t-1'' (line 18). Each object will have its own `deplacement`, which depends on the length of the circle modified by random factor (line 14). Lastly, to distinguish easily particles in the following figures, we will assign a random color to each one (line 16): `TheColor[c][o]`
<texcode>
and We can make things more interesting by adding a lot of particles, having a moving frame,..., and increase the definition : to 2160x2160 (you can go full-screen!) :  
<!-- [[File:Project1-C2-1080.mp4]] -->
[[File:Project1-C2-2160.mp4|500px]]
We can also play with the timing of the animation (code not shown) : [[File:Project1-B-Slow.mp4|500px]]
 
Here are some littles hand drawn houses (code not shown):
[[File:Project2-B2.mp4|500px]]
36

edits

Navigation menu