public TransformSequence<T> Create<X>(string property, X to, float duration, Easing easing, string? name, Func<X, X, float, X> interpolation) {
PropertyInfo? propertyInfo = typeof(T).GetProperty(property);
if (propertyInfo == null) throw new InvalidOperationException($"Property {property} does not exist in {typeof(T).Name}");
X a = FutureData.TryGetValue(property, out object? value) ? (X)value : (X)propertyInfo.GetValue(Target)!;
Transform transform = new(t => {
X value = interpolation(a, to, t);
propertyInfo.SetValue(Target, value);
}) {
Name = name ?? property,
Duration = duration,
Easing = EasingHelper.FromEaseType(easing)
};
FutureData[property] = to!;
if (Name == string.Empty) Name = property;
return Append(transform);
}
public TransformSequence<T> Create<X>(string property, X to, float duration, Easing easing, string? name, Func<X, X, float, X> interpolation) {
PropertyInfo? propertyInfo = typeof(T).GetProperty(property);
if (propertyInfo == null) throw new InvalidOperationException($"Property {property} does not exist in {typeof(T).Name}");
X a = FutureData.TryGetValue(property, out object? value) ? (X)value : (X)propertyInfo.GetValue(Target)!;
Transform transform = new(t => {
X value = interpolation(a, to, t);
propertyInfo.SetValue(Target, value);
}) {
Name = name ?? property,
Duration = duration,
Easing = EasingHelper.FromEaseType(easing)
};
FutureData[property] = to!;
if (Name == string.Empty) Name = property;
return Append(transform);
}