Gondwana Game Engine Development (master) - 2.6.1
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop and web platforms using SkiaSharp for graphics and pluggable audio backends for desktop and browser targets.
Loading...
Searching...
No Matches
WipeEffects.cs
4
5namespace Gondwana.Effects;
6
8public abstract class WipeEffect : DisplayEffect
9{
10 private readonly bool _isFill;
11 private float _originalReveal;
12 private EffectDirection _originalDirection;
13 private float _startReveal;
14 private float _targetReveal;
15
23 private protected WipeEffect(
24 EffectDirection direction,
25 float durationSeconds,
26 EasingKind easing,
27 bool isFill)
28 : base(durationSeconds, easing)
29 {
30 if (direction == EffectDirection.None)
31 throw new ArgumentOutOfRangeException(nameof(direction));
32
33 Direction = direction;
34 _isFill = isFill;
35 }
36
38 public EffectDirection Direction { get; }
39
40 internal override EffectChannel Channel => EffectChannel.Reveal;
41
42 internal override bool SupportsTarget(object target) =>
43 target is View or SceneLayer;
44
46 private protected override void OnStarting()
47 {
48 _originalReveal = EffectTargetAccess.GetReveal(Target);
49 _originalDirection = EffectTargetAccess.GetRevealDirection(Target);
50
51 if (_isFill)
52 {
53 _startReveal = _originalReveal >= 0.9999f ? 0f : _originalReveal;
54 _targetReveal = 1f;
55 }
56 else
57 {
58 _startReveal = _originalReveal;
59 _targetReveal = 0f;
60 }
61
62 EffectTargetAccess.SetReveal(Target, _startReveal, Direction);
63 }
64
66 private protected override void ApplyProgress(float progress) =>
67 EffectTargetAccess.SetReveal(
68 Target,
69 _startReveal + (_targetReveal - _startReveal) * progress,
70 Direction);
71
73 private protected override void RestoreOriginalState() =>
74 EffectTargetAccess.SetReveal(Target, _originalReveal, _originalDirection);
75}
76
78public sealed class FillEffect : WipeEffect
79{
84 public FillEffect(
85 EffectDirection direction,
86 float durationSeconds,
87 EasingKind easing = EasingKind.Linear)
88 : base(direction, durationSeconds, easing, isFill: true)
89 {
90 }
91}
92
94public sealed class EraseEffect : WipeEffect
95{
101 EffectDirection direction,
102 float durationSeconds,
103 EasingKind easing = EasingKind.Linear)
104 : base(direction, durationSeconds, easing, isFill: false)
105 {
106 }
107}
DisplayEffect(float durationSeconds, EasingKind easing=EasingKind.Linear)
Initializes a new instance of the DisplayEffect class.
EraseEffect(EffectDirection direction, float durationSeconds, EasingKind easing=EasingKind.Linear)
Creates a directional erase effect.
FillEffect(EffectDirection direction, float durationSeconds, EasingKind easing=EasingKind.Linear)
Creates a directional fill effect.
EffectDirection Direction
Gets the direction in which the wipe travels.
WipeEffect(EffectDirection direction, float durationSeconds, EasingKind easing, bool isFill)
Initializes a new instance of the WipeEffect class.
override void OnStarting()
Captures or prepares target state before the effect starts.
override void ApplyProgress(float progress)
override void RestoreOriginalState()
Represents a rendered view of a scene, combining a camera position with a viewport configuration to c...
Definition View.cs:14
Represents a single layer within a Scene, containing a grid of tiles and supporting various coordinat...
Definition SceneLayer.cs:40
EffectDirection
Specifies the direction in which a directional display effect travels.
EasingKind
Enumeration of all supported easing functions for animation and movement interpolation....
Definition EasingKind.cs:9