KLingo Project Documentation 1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
UEaseComponent.h
이 파일의 문서화 페이지로 가기
1// Copyright (c) 2025 Doppleddiggong. All rights reserved. Unauthorized copying, modification, or distribution of this file, via any medium is strictly prohibited. Proprietary and confidential.
2
7#pragma once
8
9#include "CoreMinimal.h"
10#include "FEaseHelper.h"
11#include "Components/ActorComponent.h"
12#include "UEaseComponent.generated.h"
13
17USTRUCT(BlueprintType)
19{
20 GENERATED_BODY()
21
22 UPROPERTY(EditAnywhere, BlueprintReadWrite)
23 EEaseType EaseType = EEaseType::Linear;
24
25 UPROPERTY(EditAnywhere, BlueprintReadWrite)
26 float Current = 0.f;
27
28 UPROPERTY(EditAnywhere, BlueprintReadWrite)
29 float Start = 0.f;
30
31 UPROPERTY(EditAnywhere, BlueprintReadWrite)
32 float Target = 0.f;
33
34 UPROPERTY(EditAnywhere, BlueprintReadWrite)
35 float Duration = 1.f;
36 float ElapsedTime = 0.f;
37
39 float GetAlpha() const
40 {
41 return FMath::Clamp(Duration > 0.f ? ElapsedTime / Duration : 1.f, 0.f, 1.f);
42}
43
45 void Update(float DeltaTime)
46 {
47 ElapsedTime += DeltaTime;
48 float Alpha = FMath::Clamp(Duration > 0.f ? ElapsedTime / Duration : 1.f, 0.f, 1.f);
49 Current = FMath::Lerp(Start, Target, FEaseHelper::Ease(Alpha, EaseType));
50 }
51};
52
56USTRUCT(BlueprintType)
58{
59 GENERATED_BODY()
60
61 UPROPERTY(EditAnywhere, BlueprintReadWrite)
62 EEaseType EaseType = EEaseType::Linear;
63
64 UPROPERTY(EditAnywhere, BlueprintReadWrite)
65 FVector Current = FVector::ZeroVector;
66
67 UPROPERTY(EditAnywhere, BlueprintReadWrite)
68 FVector Start = FVector::ZeroVector;
69
70 UPROPERTY(EditAnywhere, BlueprintReadWrite)
71 FVector Target = FVector::ZeroVector;
72
73 UPROPERTY(EditAnywhere, BlueprintReadWrite)
74 float Duration = 1.f;
75
76 float ElapsedTime = 0.f;
77
79 float GetAlpha() const
80 {
81 return FMath::Clamp(Duration > 0.f ? ElapsedTime / Duration : 1.f, 0.f, 1.f);
82 }
83
85 void Update(float DeltaTime)
86 {
87 ElapsedTime += DeltaTime;
88 float Alpha = FMath::Clamp(Duration > 0.f ? ElapsedTime / Duration : 1.f, 0.f, 1.f);
89 Current = FMath::Lerp(Start, Target, FEaseHelper::Ease(Alpha, EaseType));
90 }
91};
92
96USTRUCT(BlueprintType)
98{
99 GENERATED_BODY()
100
101 UPROPERTY(EditAnywhere, BlueprintReadWrite)
102 EEaseType EaseType = EEaseType::Linear;
103
104 UPROPERTY(EditAnywhere, BlueprintReadWrite)
105 FRotator Current = FRotator::ZeroRotator;
106
107 UPROPERTY(EditAnywhere, BlueprintReadWrite)
108 FRotator Start = FRotator::ZeroRotator;
109
110 UPROPERTY(EditAnywhere, BlueprintReadWrite)
111 FRotator Target = FRotator::ZeroRotator;
112
113 UPROPERTY(EditAnywhere, BlueprintReadWrite)
114 float Duration = 1.f;
115
116 float ElapsedTime = 0.f;
117
119 float GetAlpha() const
120 {
121 return FMath::Clamp(Duration > 0.f ? ElapsedTime / Duration : 1.f, 0.f, 1.f);
122 }
123
125 void Update(float DeltaTime)
126 {
127 ElapsedTime += DeltaTime;
128 float Alpha = FMath::Clamp(Duration > 0.f ? ElapsedTime / Duration : 1.f, 0.f, 1.f);
129 Current = FMath::Lerp(Start, Target, FEaseHelper::Ease(Alpha, EaseType));
130 }
131};
132
133
137UCLASS( ClassGroup=(CoffeeLibrary), meta=(BlueprintSpawnableComponent, DisplayName="EaseComponent") )
138class COFFEELIBRARY_API UEaseComponent : public UActorComponent
139{
140 GENERATED_BODY()
141public:
142 UEaseComponent();
143
144public:
146 virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
148 void UpdateTrack(float DeltaTime);
149
151 UFUNCTION(BlueprintPure, Category="Track")
152 float GetTrackAlpha(FName TrankName) const;
153
155 UFUNCTION(BlueprintPure, Category="Track")
156 float GetEaseFloatTrack(FName TrackName);
158 UFUNCTION(BlueprintCallable, Category="Track")
159 void SetEaseFloatTrack(FName TrackName, EEaseType EaseType, float Start, float Target, float Duration = 1.f);
160
162 UFUNCTION(BlueprintPure, Category="Track")
163 FVector GetEaseVectorTrack(FName TrackName);
165 UFUNCTION(BlueprintCallable, Category="Track")
166 void SetEaseVectorTrack(FName TrackName, EEaseType EaseType, FVector Start, FVector Target, float Duration = 1.f);
167
169 UFUNCTION(BlueprintPure, Category="Track")
170 FRotator GetEaseRotatorTrack(FName TrackName);
172 UFUNCTION(BlueprintCallable, Category="Track")
173 void SetEaseRotatorTrack(FName TrackName, EEaseType EaseType, FRotator Start, FRotator Target, float Duration = 1.f);
174
175private:
176 TMap<FName, FEaseFloatTrack> FloatTracks;
177 TMap<FName, FEaseVectorTrack> VectorTracks;
178 TMap<FName, FEaseRotatorTrack> RotatorTracks;
179};
EEaseType 클래스를 선언합니다.
EEaseType
Definition FEaseHelper.h:9
단일 float 값을 시간에 따라 Ease 처리하는 트랙 데이터입니다.
void Update(float DeltaTime)
경과 시간을 누적하고 Ease 결과를 갱신한다.
static float Ease(float Alpha, EEaseType Type)
Definition FEaseHelper.h:45
FRotator 값을 시간에 따라 Ease 처리하는 트랙 데이터입니다.
void Update(float DeltaTime)
경과 시간을 누적하고 Ease 결과를 갱신한다.
FVector 값을 시간에 따라 Ease 처리하는 트랙 데이터입니다.
void Update(float DeltaTime)
경과 시간을 누적하고 Ease 결과를 갱신한다.