Class SpriteFader
Used to fade a sprite from one color to another
Namespace: WeaverCore.Components
Assembly: WeaverCore.dll
Syntax
public class SpriteFader : MonoBehaviour
Fields
| Edit this page View SourceDoneBehaviour
Declaration
[Tooltip("What should this script do when done fading?")]
public OnDoneBehaviour DoneBehaviour
Field Value
Type | Description |
---|---|
OnDoneBehaviour |
Duration
Declaration
[Tooltip("How long it should take to fade from one color to another")]
public float Duration
Field Value
Type | Description |
---|---|
float |
FadeOnStart
Declaration
[Tooltip("Should this script start fading upon Awake?")]
public bool FadeOnStart
Field Value
Type | Description |
---|---|
bool |
Properties
| Edit this page View SourceFromColor
The color to fade from
Declaration
public Color FromColor { get; set; }
Property Value
Type | Description |
---|---|
Color |
Renderer
Declaration
public SpriteRenderer Renderer { get; set; }
Property Value
Type | Description |
---|---|
SpriteRenderer |
ToColor
The color to fade to
Declaration
public Color ToColor { get; set; }
Property Value
Type | Description |
---|---|
Color |
Methods
| Edit this page View SourceFadeToColor(Color, float)
Fades the sprite into a new color
Declaration
public void FadeToColor(Color toColor, float duration = -1)
Parameters
Type | Name | Description |
---|---|---|
Color | toColor | The color to fade to |
float | duration | How long to should it take to fade? If set to -1, it will use the default Duration specified on the component |
FadeToColor(Color, Color, float)
Fades the sprite from an old color to a new one
Declaration
public void FadeToColor(Color fromColor, Color toColor, float duration = -1)
Parameters
Type | Name | Description |
---|---|---|
Color | fromColor | The color to fade from |
Color | toColor | The color to fade to |
float | duration | How long to should it take to fade? If set to -1, it will use the default Duration specified on the component |
FadeToTransparency(float)
Fades the sprite into transparency
Declaration
public void FadeToTransparency(float duration = -1)
Parameters
Type | Name | Description |
---|---|---|
float | duration | How long to should it take to fade? If set to -1, it will use the default Duration specified on the component |
FadeToTransparency(Color, float)
Fades from a color to transparency
Declaration
public void FadeToTransparency(Color fromColor, float duration = -1)
Parameters
Type | Name | Description |
---|---|---|
Color | fromColor | The color to fade from |
float | duration | How long to should it take to fade? If set to -1, it will use the default Duration specified on the component |