Version: 2021.2
Force over Lifetime module
Color by Speed module

Color over Lifetime module

此模块指定粒子的颜色和透明度在其生命周期中如何变化。

Using the Color over Lifetime module

This module is part of the Particle System component. When you create a new Particle System GameObject, or add a Particle System component to an exiting GameObject, Unity adds the Color over Lifetime module to the Particle System. By default, Unity disables this module. To create a new Particle System and enable this module:

  1. Click GameObject > Effects > Particle System.
  2. In the Inspector, find the Particle System component.
  3. In the Particle System component, find the Color over Lifetime module fold-out.
  4. To the left of the fold-out header, enable the checkbox.

API

Since this module is part of the Particle System component, you access it through the ParticleSystem class. For information on how to access it and change values at runtime, see the Color over Lifetime module API documentation.

属性

For some properties in this section, you can use different modes to set their value. For information on the modes you can use, see Varying properties over time.

属性: 功能:
Color 粒子在其生命周期内的颜色渐变。渐变条的左侧点表示粒子寿命的开始,而渐变条的右侧表示粒子寿命的结束。

在上图中,粒子从橙色开始,随着时间的推移逐渐变淡,并在其寿命结束时不可见。

详细信息

许多类型的天然和超现实粒子的颜色随时间而变化,因此该属性有许多用途。例如,白色强火花在通过空气时会冷却,魔法可能会突然变成彩虹色。但同样重要的还有 Alpha(透明度)的变化。粒子在达到其生命周期终点时燃尽、褪色或消散是很常见的现象(例如,强火花、烟花和烟雾粒子),通过简单的梯度渐变即可产生这种效果。

When also using the Start Color property, this module multiples the 2 colors together, to get the final particle color.

Force over Lifetime module
Color by Speed module