Here is how I envision particle targeting to work in Lepton:
- Create a particle group to contain the "target" particles. Populate this group with particles with the desired final state for your interpolated particles.
- Create a particle group to contain the interpolated particles with a target controller pointing at the target particle group.
- Create or emit particles into the interpolated group however you see fit. Each new particle is matched with a particle in the target group. This matching can be done automatically or manually.
- Each time the interpolated group is updated, particle attributes are interpolated between the initial particle state and the target particle state using a tweening function.
Here's some theoretical sample code for targeting:
target_particles = ParticleGroup()
# ... populate target_particles ...
terps = ParticleGroup(
controllers=[
TargetRandom(target_particles,
position=EaseInOutQuad(10),
up=EaseInCirc(8)),
])
There will be several types of target controllers: Target will require interpolated particles to be matched to their targets manually, TargetRandom will randomly select targets, and TargetSequential will select targets in the order they occur in the target group. The interpolation behavior will be the same for these controller classes.Interpolation of each attribute will be controlled by tweening functions. The keyword arguments passed to the target controller specify which particle attributes to interpolate and which tweening function to use. The simplest tween is just a linear interpolator, but more complex tweens, such as easings will create more natural looking movement and morphing. You can find a great discussion of tweening and easings in this document.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.