Originally posted by The_Magician
[B]mmmm, nice Bobo.How do you get particles to read an animation curve?
Like, for a basic example, lets say that there’s a trail of particles being left behind a moving particle, and we want those that are spawned to have a life of… 30 frames, variation 15.
How can you get these spawned particles to read the curve of the shape they are being instanced off? Also, seeing as these particles may have a longer or shorter lifespan then the total animation time fo the instanced shape (due to the 15 variations), is it possable to have the animation time scale itself to fit the life of the particle?
I know you can just tick “Animated Shape” in the shape instance operator, that just reads the curve of the initial shape. [/B]
This is easy (but you have to assign the mesh instance “by hand” in a script):
*Create a Cylinder01 with height 10 and radius 1, Height Segs 16, Sides 6.
*Add a Bend modifier and animate the Angle on frame 29 to 360 degrees (this gives you a donut on frame 29!)
*Create a default Particle Flow, delete the Rotation operator
*Add a Delete operator after the Speed Operator. Set to “By Particle Age” and Life Span 20, Variation 10
*AFTER the Delete Operator, add a Script Operator
Enter the following script:
on ChannelsUsed pCont do
(
pCont.useAge = true
pCont.useLifeSpan = true
pCont.useShape = true
)
on Init pCont do ()
on Proceed pCont do
(
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
at time (30.0*pCont.particleAge.frame/pCont.ParticleLifespan.frame) pCont.particleShape = $Cylinder01.mesh
)
)
on Release pCont do ()
This code takes the age, the expected life span and calculates a normalized time (0.0-1.0). Multiplied by the length of the shape animation (30.0 frames) gives you the source time to extract the mesh from the cylinder.
Now if you play the animation, you will see that any particle that reaches the “donut” state (frame 29 of the cylinder) will be automatically dead within the next frame! (Similarities to the movie “The Ring” are completely intentional :))
This proves that the particles, no matter how long they live, always acquire the right shape from the 30 frames cylinder animation!
Even better - since the result of the time calculation is a floating - point number, we are actually subsampling the cylinder’s animation. To prove this, slide the key from frame 29 to frame 1.
Now you have a Bend between frames 0 and 1 only.
Open the script and change the “30.0” to “2.0”:
at time (2.0*pCont.particleAge.frame/pCont.ParticleLifespan.frame) pCont.particleShape = $Cylinder01.mesh
Play back the animation - you will notice that eventhough the cylinder is animated on two frames only, the particles will grab as many sub-samples as necessary to give you 20, 30 or whatever frames of shape animation!
Cool, eh? 
Cheers,
Bobo

Maybe one day I will. Now Im stuck with Java programming sigh