A game framework written with osu! in mind.
at master 489 lines 29 kB view raw
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. 2// See the LICENCE file in the repository root for full licence text. 3 4using osuTK; 5using osuTK.Graphics; 6using osu.Framework.Graphics.Colour; 7using osu.Framework.Graphics.Containers; 8using osu.Framework.Graphics.Transforms; 9using osu.Framework.Threading; 10using System; 11using JetBrains.Annotations; 12using osu.Framework.Bindables; 13 14namespace osu.Framework.Graphics 15{ 16 public static class TransformSequenceExtensions 17 { 18 public static TransformSequence<T> Expire<T>(this TransformSequence<T> t, bool calculateLifetimeStart = false) 19 where T : Drawable 20 => t.Append(o => o.Expire(calculateLifetimeStart)); 21 22 public static TransformSequence<T> Schedule<T>(this TransformSequence<T> t, Action scheduledAction) 23 where T : Drawable 24 => t.Append(o => o.Schedule(scheduledAction)); 25 26 public static TransformSequence<T> Schedule<T>(this TransformSequence<T> t, Action scheduledAction, out ScheduledDelegate scheduledDelegate) 27 where T : Drawable 28 => t.Append(o => o.Schedule(scheduledAction), out scheduledDelegate); 29 30 public static TransformSequence<T> Spin<T>(this TransformSequence<T> t, double revolutionDuration, RotationDirection direction, float startRotation = 0) 31 where T : Drawable 32 => t.Loop(d => d.RotateTo(startRotation).RotateTo(startRotation + (direction == RotationDirection.Clockwise ? 360 : -360), revolutionDuration)); 33 34 public static TransformSequence<T> Spin<T>(this TransformSequence<T> t, double revolutionDuration, RotationDirection direction, float startRotation, int numRevolutions) 35 where T : Drawable 36 => t.Loop(0, numRevolutions, d => d.RotateTo(startRotation).RotateTo(startRotation + (direction == RotationDirection.Clockwise ? 360 : -360), revolutionDuration)); 37 38 #region Easing 39 40 /// <summary> 41 /// Smoothly adjusts <see cref="Drawable.Alpha"/> to 1 over time. 42 /// </summary> 43 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 44 public static TransformSequence<T> FadeIn<T>(this TransformSequence<T> t, double duration = 0, Easing easing = Easing.None) 45 where T : Drawable 46 => t.FadeIn(duration, new DefaultEasingFunction(easing)); 47 48 /// <summary> 49 /// Smoothly adjusts <see cref="Drawable.Alpha"/> from 0 to 1 over time. 50 /// </summary> 51 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 52 public static TransformSequence<T> FadeInFromZero<T>(this TransformSequence<T> t, double duration = 0, Easing easing = Easing.None) 53 where T : Drawable 54 => t.FadeInFromZero(duration, new DefaultEasingFunction(easing)); 55 56 /// <summary> 57 /// Smoothly adjusts <see cref="Drawable.Alpha"/> to 0 over time. 58 /// </summary> 59 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 60 public static TransformSequence<T> FadeOut<T>(this TransformSequence<T> t, double duration = 0, Easing easing = Easing.None) 61 where T : Drawable 62 => t.FadeOut(duration, new DefaultEasingFunction(easing)); 63 64 /// <summary> 65 /// Smoothly adjusts <see cref="Drawable.Alpha"/> from 1 to 0 over time. 66 /// </summary> 67 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 68 public static TransformSequence<T> FadeOutFromOne<T>(this TransformSequence<T> t, double duration = 0, Easing easing = Easing.None) 69 where T : Drawable 70 => t.FadeOutFromOne(duration, new DefaultEasingFunction(easing)); 71 72 /// <summary> 73 /// Smoothly adjusts <see cref="Drawable.Alpha"/> over time. 74 /// </summary> 75 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 76 public static TransformSequence<T> FadeTo<T>(this TransformSequence<T> t, float newAlpha, double duration = 0, Easing easing = Easing.None) 77 where T : Drawable 78 => t.FadeTo(newAlpha, duration, new DefaultEasingFunction(easing)); 79 80 /// <summary> 81 /// Smoothly adjusts <see cref="Drawable.Colour"/> over time. 82 /// </summary> 83 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 84 public static TransformSequence<T> FadeColour<T>(this TransformSequence<T> t, ColourInfo newColour, double duration = 0, Easing easing = Easing.None) 85 where T : Drawable 86 => t.FadeColour(newColour, duration, new DefaultEasingFunction(easing)); 87 88 /// <summary> 89 /// Instantaneously flashes <see cref="Drawable.Colour"/>, then smoothly changes it back over time. 90 /// </summary> 91 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 92 public static TransformSequence<T> FlashColour<T>(this TransformSequence<T> t, ColourInfo flashColour, double duration, Easing easing = Easing.None) 93 where T : Drawable 94 => t.FlashColour(flashColour, duration, new DefaultEasingFunction(easing)); 95 96 /// <summary> 97 /// Smoothly adjusts <see cref="Drawable.Rotation"/> over time. 98 /// </summary> 99 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 100 public static TransformSequence<T> RotateTo<T>(this TransformSequence<T> t, float newRotation, double duration = 0, Easing easing = Easing.None) 101 where T : Drawable 102 => t.RotateTo(newRotation, duration, new DefaultEasingFunction(easing)); 103 104 /// <summary> 105 /// Smoothly adjusts <see cref="Drawable.Scale"/> over time. 106 /// </summary> 107 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 108 public static TransformSequence<T> ScaleTo<T>(this TransformSequence<T> t, float newScale, double duration = 0, Easing easing = Easing.None) 109 where T : Drawable 110 => t.ScaleTo(newScale, duration, new DefaultEasingFunction(easing)); 111 112 /// <summary> 113 /// Smoothly adjusts <see cref="Drawable.Scale"/> over time. 114 /// </summary> 115 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 116 public static TransformSequence<T> ScaleTo<T>(this TransformSequence<T> t, Vector2 newScale, double duration = 0, Easing easing = Easing.None) 117 where T : Drawable 118 => t.ScaleTo(newScale, duration, new DefaultEasingFunction(easing)); 119 120 /// <summary> 121 /// Smoothly adjusts <see cref="Drawable.Size"/> over time. 122 /// </summary> 123 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 124 public static TransformSequence<T> ResizeTo<T>(this TransformSequence<T> t, float newSize, double duration = 0, Easing easing = Easing.None) 125 where T : Drawable 126 => t.ResizeTo(newSize, duration, new DefaultEasingFunction(easing)); 127 128 /// <summary> 129 /// Smoothly adjusts <see cref="Drawable.Size"/> over time. 130 /// </summary> 131 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 132 public static TransformSequence<T> ResizeTo<T>(this TransformSequence<T> t, Vector2 newSize, double duration = 0, Easing easing = Easing.None) 133 where T : Drawable 134 => t.ResizeTo(newSize, duration, new DefaultEasingFunction(easing)); 135 136 /// <summary> 137 /// Smoothly adjusts <see cref="Drawable.Width"/> over time. 138 /// </summary> 139 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 140 public static TransformSequence<T> ResizeWidthTo<T>(this TransformSequence<T> t, float newWidth, double duration = 0, Easing easing = Easing.None) 141 where T : Drawable 142 => t.ResizeWidthTo(newWidth, duration, new DefaultEasingFunction(easing)); 143 144 /// <summary> 145 /// Smoothly adjusts <see cref="Drawable.Height"/> over time. 146 /// </summary> 147 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 148 public static TransformSequence<T> ResizeHeightTo<T>(this TransformSequence<T> t, float newHeight, double duration = 0, Easing easing = Easing.None) 149 where T : Drawable 150 => t.ResizeHeightTo(newHeight, duration, new DefaultEasingFunction(easing)); 151 152 /// <summary> 153 /// Smoothly adjusts <see cref="Drawable.Position"/> over time. 154 /// </summary> 155 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 156 public static TransformSequence<T> MoveTo<T>(this TransformSequence<T> t, Vector2 newPosition, double duration = 0, Easing easing = Easing.None) 157 where T : Drawable 158 => t.MoveTo(newPosition, duration, new DefaultEasingFunction(easing)); 159 160 /// <summary> 161 /// Smoothly adjusts <see cref="Drawable.X"/> or <see cref="Drawable.Y"/> over time. 162 /// </summary> 163 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 164 public static TransformSequence<T> MoveTo<T>(this TransformSequence<T> t, Direction direction, float destination, double duration = 0, Easing easing = Easing.None) 165 where T : Drawable 166 => t.MoveTo(direction, destination, duration, new DefaultEasingFunction(easing)); 167 168 /// <summary> 169 /// Smoothly adjusts <see cref="Drawable.X"/> over time. 170 /// </summary> 171 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 172 public static TransformSequence<T> MoveToX<T>(this TransformSequence<T> t, float destination, double duration = 0, Easing easing = Easing.None) 173 where T : Drawable 174 => t.MoveToX(destination, duration, new DefaultEasingFunction(easing)); 175 176 /// <summary> 177 /// Smoothly adjusts <see cref="Drawable.Y"/> over time. 178 /// </summary> 179 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 180 public static TransformSequence<T> MoveToY<T>(this TransformSequence<T> t, float destination, double duration = 0, Easing easing = Easing.None) 181 where T : Drawable 182 => t.MoveToY(destination, duration, new DefaultEasingFunction(easing)); 183 184 /// <summary> 185 /// Smoothly adjusts <see cref="Drawable.Position"/> by an offset to its final value over time. 186 /// </summary> 187 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 188 public static TransformSequence<T> MoveToOffset<T>(this TransformSequence<T> t, Vector2 offset, double duration = 0, Easing easing = Easing.None) 189 where T : Drawable 190 => t.MoveToOffset(offset, duration, new DefaultEasingFunction(easing)); 191 192 /// <summary> 193 /// Smoothly adjusts the alpha channel of the colour of <see cref="IContainer.EdgeEffect"/> over time. 194 /// </summary> 195 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 196 public static TransformSequence<T> FadeEdgeEffectTo<T>(this TransformSequence<T> t, float newAlpha, double duration, Easing easing = Easing.None) 197 where T : class, IContainer 198 => t.FadeEdgeEffectTo(newAlpha, duration, new DefaultEasingFunction(easing)); 199 200 /// <summary> 201 /// Smoothly adjusts the colour of <see cref="IContainer.EdgeEffect"/> over time. 202 /// </summary> 203 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 204 public static TransformSequence<T> FadeEdgeEffectTo<T>(this TransformSequence<T> t, Color4 newColour, double duration = 0, Easing easing = Easing.None) 205 where T : class, IContainer 206 => t.FadeEdgeEffectTo(newColour, duration, new DefaultEasingFunction(easing)); 207 208 /// <summary> 209 /// Smoothly adjusts <see cref="IContainer.RelativeChildSize"/> over time. 210 /// </summary> 211 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 212 public static TransformSequence<T> TransformRelativeChildSizeTo<T>(this TransformSequence<T> t, Vector2 newSize, double duration = 0, Easing easing = Easing.None) 213 where T : class, IContainer 214 => t.TransformRelativeChildSizeTo(newSize, duration, new DefaultEasingFunction(easing)); 215 216 /// <summary> 217 /// Smoothly adjusts <see cref="IContainer.RelativeChildOffset"/> over time. 218 /// </summary> 219 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 220 public static TransformSequence<T> TransformRelativeChildOffsetTo<T>(this TransformSequence<T> t, Vector2 newOffset, double duration = 0, Easing easing = Easing.None) 221 where T : class, IContainer 222 => t.TransformRelativeChildOffsetTo(newOffset, duration, new DefaultEasingFunction(easing)); 223 224 /// <summary> 225 /// Smoothly adjusts <see cref="IBufferedContainer.BlurSigma"/> over time. 226 /// </summary> 227 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 228 public static TransformSequence<T> BlurTo<T>(this TransformSequence<T> t, Vector2 newBlurSigma, double duration = 0, Easing easing = Easing.None) 229 where T : class, IBufferedContainer 230 => t.BlurTo(newBlurSigma, duration, new DefaultEasingFunction(easing)); 231 232 /// <summary> 233 /// Smoothly adjusts <see cref="IFillFlowContainer.Spacing"/> over time. 234 /// </summary> 235 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 236 public static TransformSequence<T> TransformSpacingTo<T>(this TransformSequence<T> t, Vector2 newSpacing, double duration = 0, Easing easing = Easing.None) 237 where T : class, IFillFlowContainer 238 => t.TransformSpacingTo(newSpacing, duration, new DefaultEasingFunction(easing)); 239 240 /// <summary> 241 /// Smoothly adjusts the value of a <see cref="Bindable{TValue}"/> over time. 242 /// </summary> 243 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 244 public static TransformSequence<T> TransformBindableTo<T, TValue>(this TransformSequence<T> t, [NotNull] Bindable<TValue> bindable, TValue newValue, double duration = 0, 245 Easing easing = Easing.None) 246 where T : class, ITransformable 247 => t.TransformBindableTo(bindable, newValue, duration, new DefaultEasingFunction(easing)); 248 249 #endregion 250 251 #region Generic Easing 252 253 /// <summary> 254 /// Smoothly adjusts <see cref="Drawable.Alpha"/> to 1 over time. 255 /// </summary> 256 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 257 public static TransformSequence<T> FadeIn<T, TEasing>(this TransformSequence<T> t, double duration, TEasing easing) 258 where T : Drawable 259 where TEasing : IEasingFunction 260 => t.Append(o => o.FadeIn(duration, easing)); 261 262 /// <summary> 263 /// Smoothly adjusts <see cref="Drawable.Alpha"/> from 0 to 1 over time. 264 /// </summary> 265 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 266 public static TransformSequence<T> FadeInFromZero<T, TEasing>(this TransformSequence<T> t, double duration, TEasing easing) 267 where T : Drawable 268 where TEasing : IEasingFunction 269 => t.Append(o => o.FadeInFromZero(duration, easing)); 270 271 /// <summary> 272 /// Smoothly adjusts <see cref="Drawable.Alpha"/> to 0 over time. 273 /// </summary> 274 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 275 public static TransformSequence<T> FadeOut<T, TEasing>(this TransformSequence<T> t, double duration, TEasing easing) 276 where T : Drawable 277 where TEasing : IEasingFunction 278 => t.Append(o => o.FadeOut(duration, easing)); 279 280 /// <summary> 281 /// Smoothly adjusts <see cref="Drawable.Alpha"/> from 1 to 0 over time. 282 /// </summary> 283 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 284 public static TransformSequence<T> FadeOutFromOne<T, TEasing>(this TransformSequence<T> t, double duration, TEasing easing) 285 where T : Drawable 286 where TEasing : IEasingFunction 287 => t.Append(o => o.FadeOutFromOne(duration, easing)); 288 289 /// <summary> 290 /// Smoothly adjusts <see cref="Drawable.Alpha"/> over time. 291 /// </summary> 292 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 293 public static TransformSequence<T> FadeTo<T, TEasing>(this TransformSequence<T> t, float newAlpha, double duration, TEasing easing) 294 where T : Drawable 295 where TEasing : IEasingFunction 296 => t.Append(o => o.FadeTo(newAlpha, duration, easing)); 297 298 /// <summary> 299 /// Smoothly adjusts <see cref="Drawable.Colour"/> over time. 300 /// </summary> 301 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 302 public static TransformSequence<T> FadeColour<T, TEasing>(this TransformSequence<T> t, ColourInfo newColour, double duration, TEasing easing) 303 where T : Drawable 304 where TEasing : IEasingFunction 305 => t.Append(o => o.FadeColour(newColour, duration, easing)); 306 307 /// <summary> 308 /// Instantaneously flashes <see cref="Drawable.Colour"/>, then smoothly changes it back over time. 309 /// </summary> 310 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 311 public static TransformSequence<T> FlashColour<T, TEasing>(this TransformSequence<T> t, ColourInfo flashColour, double duration, TEasing easing) 312 where T : Drawable 313 where TEasing : IEasingFunction 314 => t.Append(o => o.FlashColour(flashColour, duration, easing)); 315 316 /// <summary> 317 /// Smoothly adjusts <see cref="Drawable.Rotation"/> over time. 318 /// </summary> 319 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 320 public static TransformSequence<T> RotateTo<T, TEasing>(this TransformSequence<T> t, float newRotation, double duration, TEasing easing) 321 where T : Drawable 322 where TEasing : IEasingFunction 323 => t.Append(o => o.RotateTo(newRotation, duration, easing)); 324 325 /// <summary> 326 /// Smoothly adjusts <see cref="Drawable.Scale"/> over time. 327 /// </summary> 328 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 329 public static TransformSequence<T> ScaleTo<T, TEasing>(this TransformSequence<T> t, float newScale, double duration, TEasing easing) 330 where T : Drawable 331 where TEasing : IEasingFunction 332 => t.Append(o => o.ScaleTo(newScale, duration, easing)); 333 334 /// <summary> 335 /// Smoothly adjusts <see cref="Drawable.Scale"/> over time. 336 /// </summary> 337 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 338 public static TransformSequence<T> ScaleTo<T, TEasing>(this TransformSequence<T> t, Vector2 newScale, double duration, TEasing easing) 339 where T : Drawable 340 where TEasing : IEasingFunction 341 => t.Append(o => o.ScaleTo(newScale, duration, easing)); 342 343 /// <summary> 344 /// Smoothly adjusts <see cref="Drawable.Size"/> over time. 345 /// </summary> 346 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 347 public static TransformSequence<T> ResizeTo<T, TEasing>(this TransformSequence<T> t, float newSize, double duration, TEasing easing) 348 where T : Drawable 349 where TEasing : IEasingFunction 350 => t.Append(o => o.ResizeTo(newSize, duration, easing)); 351 352 /// <summary> 353 /// Smoothly adjusts <see cref="Drawable.Size"/> over time. 354 /// </summary> 355 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 356 public static TransformSequence<T> ResizeTo<T, TEasing>(this TransformSequence<T> t, Vector2 newSize, double duration, TEasing easing) 357 where T : Drawable 358 where TEasing : IEasingFunction 359 => t.Append(o => o.ResizeTo(newSize, duration, easing)); 360 361 /// <summary> 362 /// Smoothly adjusts <see cref="Drawable.Width"/> over time. 363 /// </summary> 364 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 365 public static TransformSequence<T> ResizeWidthTo<T, TEasing>(this TransformSequence<T> t, float newWidth, double duration, TEasing easing) 366 where T : Drawable 367 where TEasing : IEasingFunction 368 => t.Append(o => o.ResizeWidthTo(newWidth, duration, easing)); 369 370 /// <summary> 371 /// Smoothly adjusts <see cref="Drawable.Height"/> over time. 372 /// </summary> 373 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 374 public static TransformSequence<T> ResizeHeightTo<T, TEasing>(this TransformSequence<T> t, float newHeight, double duration, TEasing easing) 375 where T : Drawable 376 where TEasing : IEasingFunction 377 => t.Append(o => o.ResizeHeightTo(newHeight, duration, easing)); 378 379 /// <summary> 380 /// Smoothly adjusts <see cref="Drawable.Position"/> over time. 381 /// </summary> 382 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 383 public static TransformSequence<T> MoveTo<T, TEasing>(this TransformSequence<T> t, Vector2 newPosition, double duration, TEasing easing) 384 where T : Drawable 385 where TEasing : IEasingFunction 386 => t.Append(o => o.MoveTo(newPosition, duration, easing)); 387 388 /// <summary> 389 /// Smoothly adjusts <see cref="Drawable.X"/> or <see cref="Drawable.Y"/> over time. 390 /// </summary> 391 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 392 public static TransformSequence<T> MoveTo<T, TEasing>(this TransformSequence<T> t, Direction direction, float destination, double duration, TEasing easing) 393 where T : Drawable 394 where TEasing : IEasingFunction 395 => t.Append(o => o.MoveTo(direction, destination, duration, easing)); 396 397 /// <summary> 398 /// Smoothly adjusts <see cref="Drawable.X"/> over time. 399 /// </summary> 400 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 401 public static TransformSequence<T> MoveToX<T, TEasing>(this TransformSequence<T> t, float destination, double duration, TEasing easing) 402 where T : Drawable 403 where TEasing : IEasingFunction 404 => t.Append(o => o.MoveToX(destination, duration, easing)); 405 406 /// <summary> 407 /// Smoothly adjusts <see cref="Drawable.Y"/> over time. 408 /// </summary> 409 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 410 public static TransformSequence<T> MoveToY<T, TEasing>(this TransformSequence<T> t, float destination, double duration, TEasing easing) 411 where T : Drawable 412 where TEasing : IEasingFunction 413 => t.Append(o => o.MoveToY(destination, duration, easing)); 414 415 /// <summary> 416 /// Smoothly adjusts <see cref="Drawable.Position"/> by an offset to its final value over time. 417 /// </summary> 418 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 419 public static TransformSequence<T> MoveToOffset<T, TEasing>(this TransformSequence<T> t, Vector2 offset, double duration, TEasing easing) 420 where T : Drawable 421 where TEasing : IEasingFunction 422 => t.Append(o => o.MoveToOffset(offset, duration, easing)); 423 424 /// <summary> 425 /// Smoothly adjusts the alpha channel of the colour of <see cref="IContainer.EdgeEffect"/> over time. 426 /// </summary> 427 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 428 public static TransformSequence<T> FadeEdgeEffectTo<T, TEasing>(this TransformSequence<T> t, float newAlpha, double duration, TEasing easing) 429 where T : class, IContainer 430 where TEasing : IEasingFunction 431 => t.Append(o => o.FadeEdgeEffectTo(newAlpha, duration, easing)); 432 433 /// <summary> 434 /// Smoothly adjusts the colour of <see cref="IContainer.EdgeEffect"/> over time. 435 /// </summary> 436 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 437 public static TransformSequence<T> FadeEdgeEffectTo<T, TEasing>(this TransformSequence<T> t, Color4 newColour, double duration, TEasing easing) 438 where T : class, IContainer 439 where TEasing : IEasingFunction 440 => t.Append(o => o.FadeEdgeEffectTo(newColour, duration, easing)); 441 442 /// <summary> 443 /// Smoothly adjusts <see cref="IContainer.RelativeChildSize"/> over time. 444 /// </summary> 445 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 446 public static TransformSequence<T> TransformRelativeChildSizeTo<T, TEasing>(this TransformSequence<T> t, Vector2 newSize, double duration, TEasing easing) 447 where T : class, IContainer 448 where TEasing : IEasingFunction 449 => t.Append(o => o.TransformRelativeChildSizeTo(newSize, duration, easing)); 450 451 /// <summary> 452 /// Smoothly adjusts <see cref="IContainer.RelativeChildOffset"/> over time. 453 /// </summary> 454 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 455 public static TransformSequence<T> TransformRelativeChildOffsetTo<T, TEasing>(this TransformSequence<T> t, Vector2 newOffset, double duration, TEasing easing) 456 where T : class, IContainer 457 where TEasing : IEasingFunction 458 => t.Append(o => o.TransformRelativeChildOffsetTo(newOffset, duration, easing)); 459 460 /// <summary> 461 /// Smoothly adjusts <see cref="IBufferedContainer.BlurSigma"/> over time. 462 /// </summary> 463 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 464 public static TransformSequence<T> BlurTo<T, TEasing>(this TransformSequence<T> t, Vector2 newBlurSigma, double duration, TEasing easing) 465 where T : class, IBufferedContainer 466 where TEasing : IEasingFunction 467 => t.Append(o => o.BlurTo(newBlurSigma, duration, easing)); 468 469 /// <summary> 470 /// Smoothly adjusts <see cref="IFillFlowContainer.Spacing"/> over time. 471 /// </summary> 472 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 473 public static TransformSequence<T> TransformSpacingTo<T, TEasing>(this TransformSequence<T> t, Vector2 newSpacing, double duration, TEasing easing) 474 where T : class, IFillFlowContainer 475 where TEasing : IEasingFunction 476 => t.Append(o => o.TransformSpacingTo(newSpacing, duration, easing)); 477 478 /// <summary> 479 /// Smoothly adjusts the value of a <see cref="Bindable{TValue}"/> over time. 480 /// </summary> 481 /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> 482 public static TransformSequence<T> TransformBindableTo<T, TValue, TEasing>(this TransformSequence<T> t, [NotNull] Bindable<TValue> bindable, TValue newValue, double duration, TEasing easing) 483 where T : class, ITransformable 484 where TEasing : IEasingFunction 485 => t.Append(o => o.TransformBindableTo(bindable, newValue, duration, easing)); 486 487 #endregion 488 } 489}