OldBlueWater/BlueWater/Assets/Doozy/Runtime/Reactor/Extensions/RectTransformExtensions.cs
2023-08-02 15:08:03 +09:00

35 lines
1.3 KiB
C#

// Copyright (c) 2015 - 2023 Doozy Entertainment. All Rights Reserved.
// This code can only be used under the standard Unity Asset Store End User License Agreement
// A Copy of the EULA APPENDIX 1 is available at http://unity3d.com/company/legal/as_terms
using Doozy.Runtime.Reactor.Reactions;
using UnityEngine;
// ReSharper disable UnusedMember.Global
// ReSharper disable UnusedType.Global
namespace Doozy.Runtime.Reactor.Extensions
{
public static class RectTransformExtensions
{
public static Vector3Reaction AnchorPosition3DReaction(this RectTransform target, Vector3 targetValue, float duration, bool relative) =>
Reactor.To
(
() => target.anchoredPosition3D,
value => target.anchoredPosition3D = value,
targetValue,
duration,
relative
);
public static Vector3Reaction RotationReaction(this RectTransform target, Vector3 targetValue, float duration, bool relative) =>
Reactor.To
(
() => target.localEulerAngles,
value => target.localRotation = Quaternion.Euler(value),
targetValue,
duration,
relative
);
}
}