Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3055c85
feat: handling timeline deletion
JeremyMeissner May 6, 2022
7c3170f
chore: doing animation section
JeremyMeissner May 6, 2022
02d75b1
docs: add brand identity
JeremyMeissner May 7, 2022
7adcd6f
feat: shape animation list ui
JeremyMeissner May 9, 2022
3732d3c
Merge branch '5-timeline-implementation' of https://github.com/Jeremy…
JeremyMeissner May 9, 2022
6055621
chore: interpolation implementation
JeremyMeissner May 10, 2022
687c8b4
feat: timeline loop
JeremyMeissner May 11, 2022
25f76b3
refactor: global structure
JeremyMeissner May 11, 2022
1e79797
chore: add camera
JeremyMeissner May 12, 2022
548a88d
chore: change timeline logic
JeremyMeissner May 13, 2022
d5a1681
chore: remove loop/reverse
JeremyMeissner May 14, 2022
672470b
feat: angle supported
JeremyMeissner May 14, 2022
80ad23d
refactor: selector
JeremyMeissner May 15, 2022
029cb93
feat: color importation
JeremyMeissner May 16, 2022
1963b2b
refactor: timeline
JeremyMeissner May 16, 2022
432cd5f
refactor: timeline
JeremyMeissner May 17, 2022
053ccc0
refactor: remove unused code
JeremyMeissner May 18, 2022
a7cea3a
feat: add triangle
JeremyMeissner May 20, 2022
a0814c1
refactor: window class
JeremyMeissner May 23, 2022
6dba92e
chore: change d attr regex
JeremyMeissner May 25, 2022
172e538
chore: update shader
JeremyMeissner May 31, 2022
f520c1d
refactor: Renderer
JeremyMeissner Jun 1, 2022
cc7863c
fix: path drawing problem
JeremyMeissner Jun 2, 2022
e774ed9
chore: serialization
JeremyMeissner Jun 2, 2022
d153021
feat: serialization
JeremyMeissner Jun 2, 2022
860a7d2
fix: import form render
JeremyMeissner Jun 3, 2022
8a6c0b2
refactor: path structure
JeremyMeissner Jun 7, 2022
780e5b3
refactor: whole structure
JeremyMeissner Jun 8, 2022
b37ec4f
fix: picker filter reset
JeremyMeissner Jun 8, 2022
c9d0296
refactor: add comments
JeremyMeissner Jun 8, 2022
b585b8c
chore: remove useless close button
JeremyMeissner Jun 9, 2022
0808cba
refactor: whole structure
JeremyMeissner Jun 9, 2022
3666559
refactor: remove useless using
JeremyMeissner Jun 9, 2022
78bdd4c
Merge branch 'master' into 5-timeline-implementation
JeremyMeissner Jun 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: whole structure
  • Loading branch information
JeremyMeissner committed Jun 8, 2022
commit 780e5b31a10e4d8dd5dd6718d81a5fafff4598ce
137 changes: 45 additions & 92 deletions FreeFrame/Components/Shapes/Path/DrawAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,35 @@ public abstract class DrawAttribute
public static (int X, int Y, int X1, int Y1) Last = (0, 0, 0, 0);

/// <summary>
/// Should return the vertices position in NDC format
/// Update the Last drawn values
/// </summary>
/// <returns>array of vertices position. x, y, x, y, ... (clockwise)</returns>
///
public abstract (Vector2i position, Vector2i? controlPosition) Information();
public abstract void UpdateLast();

/// <summary>
/// Return the vertices position in NDC format
/// </summary>
/// <returns>array of vertices position. x, y, x, y, ... (clockwise)</returns>
public abstract float[] GetVertices();

/// <summary>
/// Return the indexes position of the triangles/lines
/// </summary>
/// <returns>array of indexes</returns>
public abstract uint[] GetVerticesIndexes();
public abstract void MoveDelta(Vector2i deltaPosition);

/// <summary>
/// Retrieve the points that made the attribute detectable
/// </summary>
/// <returns>Position of all the points</returns>
public abstract List<Vector2i> GetSelectablePoints();

/// <summary>
/// Retrieve the attribute for the d attribute
/// </summary>
/// <returns>string of the attribute</returns>
public abstract override string ToString();
}

/// <summary>
/// MoveTo, M or m.
/// Moving the current point to another point.
Expand All @@ -54,13 +71,15 @@ public abstract class DrawAttribute
public class MoveTo : DrawAttribute
{
public MoveTo() { }

/// <summary>
/// Moving the current point to another point.
/// </summary>
/// <param name="x">position x</param>
/// <param name="y">positin y</param>
/// <param name="isRelative">if true, the points becames relatives to the last point</param>
public MoveTo(Group x, Group y, bool isRelative = false) : this(Convert.ToInt32(x.Value), Convert.ToInt32(y.Value), isRelative) { }

/// <summary>
/// Moving the current point to another point.
/// </summary>
Expand All @@ -74,20 +93,13 @@ public MoveTo(int x, int y, bool isRelative = false)
IsRelative = isRelative;
}
public override float[] GetVertices() => Array.Empty<float>(); // Move doesnt have any vertices

public override uint[] GetVerticesIndexes() => Array.Empty<uint>();

public override string ToString() => String.Format("{0} {1},{2}", IsRelative ? 'm' : 'M', X, Y);

public override List<Vector2i> GetSelectablePoints() => new List<Vector2i>();

public override void MoveDelta(Vector2i deltaPosition)
{
X += deltaPosition.X;
Y += deltaPosition.Y;
}

public override (Vector2i position, Vector2i? controlPosition) Information() => (new Vector2i(X, Y), null);

public override void UpdateLast()
{
if (IsRelative)
Expand All @@ -102,6 +114,7 @@ public override void UpdateLast()
}
}
}

/// <summary>
/// LineTo, L or l.
/// Use to draw a straight line from the current point to the given point.
Expand All @@ -110,13 +123,15 @@ public override void UpdateLast()
public class LineTo : DrawAttribute
{
public LineTo() { }

/// <summary>
/// Use to draw a straight line from the current point to the given point.
/// </summary>
/// <param name="x">end point x</param>
/// <param name="y">end point y</param>
/// <param name="isRelative">if true, the points becames relatives to the last point</param>
public LineTo(Group x, Group y, bool isRelative = false) : this(Convert.ToInt32(x.Value), Convert.ToInt32(y.Value), isRelative) { }

/// <summary>
/// Use to draw a straight line from the current point to the given point.
/// </summary>
Expand All @@ -129,7 +144,6 @@ public LineTo(int x, int y, bool isRelative = false)
Y = y;
IsRelative = isRelative;
}

public override float[] GetVertices()
{
float[] vertices;
Expand Down Expand Up @@ -162,13 +176,6 @@ public override List<Vector2i> GetSelectablePoints()
return points;
}

public override void MoveDelta(Vector2i deltaPosition)
{
X += deltaPosition.X;
Y += deltaPosition.Y;
}
public override (Vector2i position, Vector2i? controlPosition) Information() => (new Vector2i(X, Y), null);

public override void UpdateLast()
{
if (IsRelative)
Expand All @@ -183,6 +190,7 @@ public override void UpdateLast()
}
}
}

/// <summary>
/// HorizontalLineTo, H or h.
/// Use to draw a horizontal line from the current point to the given point.
Expand All @@ -191,12 +199,14 @@ public override void UpdateLast()
public class HorizontalLineTo : DrawAttribute
{
public HorizontalLineTo() { }

/// <summary>
/// Use to draw a horizontal line from the current point to the given point.
/// </summary>
/// <param name="x">offset end point x</param>
/// <param name="isRelative">if true, the points becames relatives to the last point</param>
public HorizontalLineTo(Group x, bool isRelative = false) : this(Convert.ToInt32(x.Value), isRelative) { }

/// <summary>
/// Use to draw a horizontal line from the current point to the given point.
/// </summary>
Expand Down Expand Up @@ -241,12 +251,6 @@ public override List<Vector2i> GetSelectablePoints()
return points;
}

public override void MoveDelta(Vector2i deltaPosition)
{
X += deltaPosition.X;
}
public override (Vector2i position, Vector2i? controlPosition) Information() => (new Vector2i(X, Last.Y), null);

public override void UpdateLast()
{
if (IsRelative)
Expand All @@ -255,6 +259,7 @@ public override void UpdateLast()
Last.X = X; // Update last position
}
}

/// <summary>
/// VerticalLineTo, V or v.
/// Use to draw a vertical line from the current point to the given point.
Expand All @@ -263,12 +268,14 @@ public override void UpdateLast()
public class VerticalLineTo : DrawAttribute
{
public VerticalLineTo() { }

/// <summary>
/// Use to draw a vertical line from the current point to the given point.
/// </summary>
/// <param name="y">offset end point y</param>
/// <param name="isRelative">if true, the points becames relatives to the last point</param>
public VerticalLineTo(Group y, bool isRelative = false) : this(Convert.ToInt32(y.Value), isRelative) { }

/// <summary>
/// Use to draw a vertical line from the current point to the given point.
/// </summary>
Expand All @@ -279,7 +286,6 @@ public VerticalLineTo(int y, bool isRelative = false)
Y = y;
IsRelative = isRelative;
}

public override float[] GetVertices()
{
float[] vertices;
Expand All @@ -291,6 +297,7 @@ public override float[] GetVertices()

return vertices;
}

public override uint[] GetVerticesIndexes() => new uint[] { 0, 1 };

public override List<Vector2i> GetSelectablePoints()
Expand All @@ -312,16 +319,6 @@ public override List<Vector2i> GetSelectablePoints()

public override string ToString() => String.Format("{0} {1}", IsRelative ? 'v' : 'V', Y);

public override void MoveDelta(Vector2i deltaPosition)
{
throw new NotImplementedException();
}

public override (Vector2i position, Vector2i? controlPosition) Information()
{
throw new NotImplementedException();
}

public override void UpdateLast()
{
if (IsRelative)
Expand All @@ -330,6 +327,7 @@ public override void UpdateLast()
Last.Y = Y; // Update last position
}
}

/// <summary>
/// CurveTo, Cubic Bézier Curve, C or c.
/// Use to draw a cubic Bézier curve from the current point to the given point.
Expand All @@ -344,6 +342,7 @@ public class CurveTo : DrawAttribute
public int Y2 { get => _y2; set => _y2 = value; }

public CurveTo() { }

/// <summary>
/// Use to draw a cubic Bézier curve from the current point to the given point.
/// </summary>
Expand All @@ -355,6 +354,7 @@ public CurveTo() { }
/// <param name="y">end point y</param>
/// <param name="isRelative">if true, the points becames relatives to the last point</param>
public CurveTo(Group x1, Group y1, Group x2, Group y2, Group x, Group y, bool isRelative = false) : this(Convert.ToInt32(x1.Value), Convert.ToInt32(y1.Value), Convert.ToInt32(x2.Value), Convert.ToInt32(y2.Value), Convert.ToInt32(x.Value), Convert.ToInt32(y.Value), isRelative) { }

/// <summary>
/// Use to draw a cubic Bézier curve from the current point to the given point.
/// </summary>
Expand Down Expand Up @@ -430,21 +430,6 @@ public override List<Vector2i> GetSelectablePoints()

public override string ToString() => String.Format("{0} {1},{2} {3},{4} {5},{6}", IsRelative ? 'c' : 'C', X1, Y1, X2, Y2, X, Y);

public override void MoveDelta(Vector2i deltaPosition)
{
X1 += deltaPosition.X;
Y1 += deltaPosition.Y;
X2 += deltaPosition.X;
Y2 += deltaPosition.Y;
X += deltaPosition.X;
Y += deltaPosition.Y;
}

public override (Vector2i position, Vector2i? controlPosition) Information()
{
throw new NotImplementedException();
}

public override void UpdateLast()
{
if (IsRelative)
Expand Down Expand Up @@ -487,6 +472,7 @@ public override void UpdateLast()
}
}
}

/// <summary>
/// SmoothCurveTo, Smooth Cubic Bézier Curbe, S or s.
/// Use to draw a smooth cubic Bézier curve from the current point to the given point.
Expand All @@ -501,6 +487,7 @@ public class SmoothCurveTo : DrawAttribute
public int Y2 { get => _y2; set => _y2 = value; }

public SmoothCurveTo() { }

/// <summary>
/// Use to draw a smooth cubic Bézier curve from the current point to the given point.
/// </summary>
Expand All @@ -509,8 +496,8 @@ public SmoothCurveTo() { }
/// <param name="x">end point x</param>
/// <param name="y">end point y</param>
/// <param name="isRelative">if true, the points becames relatives to the last point</param>

public SmoothCurveTo(Group x2, Group y2, Group x, Group y, bool isRelative = false) : this(Convert.ToInt32(x2.Value), Convert.ToInt32(y2.Value), Convert.ToInt32(x.Value), Convert.ToInt32(y.Value), isRelative) { }

/// <summary>
/// Use to draw a smooth cubic Bézier curve from the current point to the given point.
/// </summary>
Expand All @@ -527,6 +514,7 @@ public SmoothCurveTo(int x2, int y2, int x, int y, bool isRelative = false)
Y = y;
IsRelative = isRelative;
}

public override float[] GetVertices()
{
List<float> vertices = new List<float>();
Expand Down Expand Up @@ -582,15 +570,6 @@ public override List<Vector2i> GetSelectablePoints()

public override string ToString() => String.Format("{0} {1},{2} {3},{4}", IsRelative ? 's' : 'S', X2, Y2, X, Y);

public override void MoveDelta(Vector2i deltaPosition)
{
throw new NotImplementedException();
}
public override (Vector2i position, Vector2i? controlPosition) Information()
{
throw new NotImplementedException();
}

public override void UpdateLast()
{
if (IsRelative)
Expand Down Expand Up @@ -643,6 +622,7 @@ public override void UpdateLast()
public class QuadraticBezierCurveTo : DrawAttribute
{
public QuadraticBezierCurveTo() { }

/// <summary>
/// Use to draw a quadratic Bézier curve.
/// </summary>
Expand Down Expand Up @@ -724,16 +704,6 @@ public override List<Vector2i> GetSelectablePoints()

public override string ToString() => String.Format("{0} {1},{2} {3},{4}", IsRelative ? 'q' : 'Q', X1, Y1, X, Y);

public override void MoveDelta(Vector2i deltaPosition)
{
throw new NotImplementedException();
}

public override (Vector2i position, Vector2i? controlPosition) Information()
{
throw new NotImplementedException();
}

public override void UpdateLast()
{
if (IsRelative)
Expand Down Expand Up @@ -843,16 +813,6 @@ public override List<Vector2i> GetSelectablePoints()

public override string ToString() => String.Format("{0} {1},{2}", IsRelative ? 't' : 'T', X, Y);

public override void MoveDelta(Vector2i deltaPosition)
{
throw new NotImplementedException();
}

public override (Vector2i position, Vector2i? controlPosition) Information()
{
throw new NotImplementedException();
}

public override void UpdateLast()
{
if (IsRelative)
Expand Down Expand Up @@ -894,6 +854,7 @@ public class EllipticalArc : DrawAttribute
bool _sweepFlag;

public EllipticalArc() { }

/// <summary>
/// Use to draw an ellipse.
/// </summary>
Expand All @@ -905,8 +866,8 @@ public EllipticalArc() { }
/// <param name="x">new current point x</param>
/// <param name="y">new current point y</param>
/// <param name="isRelative">if true, the points becames relatives to the last point</param>

public EllipticalArc(Group rx, Group ry, Group angle, Group largeArcFlag, Group sweepFlag, Group x, Group y, bool isRelative = false) : this(Convert.ToInt32(rx.Value), Convert.ToInt32(ry.Value), Convert.ToInt32(angle.Value), Convert.ToInt32(largeArcFlag.Value) == 0 ? false : true, Convert.ToInt32(sweepFlag.Value) == 0 ? false : true, Convert.ToInt32(x.Value), Convert.ToInt32(y.Value), isRelative) { }

/// <summary>
/// Use to draw an ellipse.
/// </summary>
Expand Down Expand Up @@ -944,14 +905,6 @@ public override uint[] GetVerticesIndexes()
throw new NotImplementedException();
}

public override void MoveDelta(Vector2i deltaPosition)
{
throw new NotImplementedException();
}
public override (Vector2i position, Vector2i? controlPosition) Information()
{
throw new NotImplementedException();
}
public override string ToString() => String.Format("{0} {1} {2} {3} {4} {5} {6},{7}", IsRelative ? 'a' : 'A', _rx, _ry, _angle, Convert.ToInt32(_largeArcFlag), Convert.ToInt32(_sweepFlag), X, Y);

public override void UpdateLast()
Expand Down
Loading