mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2025-12-13 09:08:34 +00:00
Added some content
parent
fc92c6d4da
commit
c7bd81a47e
@ -1 +1,16 @@
|
||||
TODO
|
||||
Implementing an own gradient is quite easy.
|
||||
All you need to do is implementing the _IGradient_-interface which looks like this:
|
||||
```C#
|
||||
public interface IGradient
|
||||
{
|
||||
Color GetColor(float offset);
|
||||
}
|
||||
```
|
||||
|
||||
Just place your calculation-logic inside the _GetColor_-Method and return the Color for the requested offset. (The offset represents the percentage value of "progress" on the gradient.)
|
||||
Even if it might not be needed please handle the case of a negative offset or values greater 1!
|
||||
> Before you start take a look at the helper-methods in the _[ColorHelper](https://github.com/DarthAffe/CUE.NET/blob/master/Helper/ColorHelper.cs)_- and _[GradientHelper](https://github.com/DarthAffe/CUE.NET/blob/master/Helper/GradientHelper.cs)_-classes. They might be useful!
|
||||
|
||||
If you want to work with _GradientStops_ (like the _[LinearGradient](https://github.com/DarthAffe/CUE.NET/wiki/Linear-Gradient)_) you can derive from the _[AbstractGradient](https://github.com/DarthAffe/CUE.NET/blob/master/Gradients/AbstractGradient.cs)_-class which implements some logic helping with that.
|
||||
|
||||
If you need a reference on how the implementation might look you can take the _[LinearGradient](https://github.com/DarthAffe/CUE.NET/blob/master/Gradients/LinearGradient.cs)_ or the _[RainbowGradient](https://github.com/DarthAffe/CUE.NET/blob/master/Gradients/RainbowGradient.cs)_.
|
||||
Loading…
x
Reference in New Issue
Block a user