CrabUI
Loading...
Searching...
No Matches
Animation.cs
1using System;
2using System.Reflection;
3using System.Runtime.CompilerServices;
4using System.Collections.Generic;
5using System.Collections.Immutable;
6using System.Linq;
7
8using Barotrauma;
9using HarmonyLib;
10using Microsoft.Xna.Framework;
11using Microsoft.Xna.Framework.Graphics;
12
13using CrabUI;
14
15namespace CrabUITest
16{
17 public partial class PropTest : FillMethods
18 {
19 public static void Animation(CUIComponent Main)
20 {
21 CUIFrame frame = new CUIFrame()
22 {
23 Absolute = new CUINullRect(200, 0, 200, 400),
24 Anchor = CUIAnchor.Center,
25 };
26
27 frame.Animations["fade"] = new CUIAnimation()
28 {
29 StartValue = new Color(0, 0, 0, 32),
30 EndValue = new Color(0, 0, 32, 255),
31 Property = "BackgroundColor",
32 Duration = 0.1,
33 };
34
35
36 frame.OnMouseEnter += (e) =>
37 {
38 frame.Animations["fade"].Direction = CUIDirection.Straight;
39 frame.Animations["fade"].Start();
40 };
41
42 frame.OnMouseLeave += (e) =>
43 {
44 frame.Animations["fade"].Direction = CUIDirection.Reverse;
45 frame.Animations["fade"].Start();
46 };
47
48 Main.Append(frame);
49 }
50 }
51}
CUIAnchor is just a Vector2 This is a static class containing some helper methods.
Definition CUIAnchor.cs:18
WIP, can animate any property on any object Can run back and forth in [0..1] interval and interpolate...
Base class for all components.
virtual CUIComponent Append(CUIComponent child, string name=null, [CallerMemberName] string memberName="")
Adds children to the end of the list.
Draggable and resizable container for other components.
Definition CUIFrame.cs:16
Rectangle with float?
Definition CUIRect.cs:104