diff options
Diffstat (limited to 'scene/animation/tween.h')
-rw-r--r-- | scene/animation/tween.h | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/scene/animation/tween.h b/scene/animation/tween.h index b57ec2e5e7..345974ecc5 100644 --- a/scene/animation/tween.h +++ b/scene/animation/tween.h @@ -42,13 +42,13 @@ class Tweener : public RefCounted { public: virtual void set_tween(Ref<Tween> p_tween); virtual void start() = 0; - virtual bool step(float &r_delta) = 0; + virtual bool step(double &r_delta) = 0; void clear_tween(); protected: static void _bind_methods(); Ref<Tween> tween; - float elapsed_time = 0; + double elapsed_time = 0; bool finished = false; }; @@ -103,7 +103,7 @@ private: ObjectID bound_node; Vector<List<Ref<Tweener>>> tweeners; - float total_time = 0; + double total_time = 0; int current_step = -1; int loops = 1; int loops_done = 0; @@ -129,13 +129,13 @@ protected: static void _bind_methods(); public: - Ref<PropertyTweener> tween_property(Object *p_target, NodePath p_property, Variant p_to, float p_duration); - Ref<IntervalTweener> tween_interval(float p_time); + Ref<PropertyTweener> tween_property(Object *p_target, NodePath p_property, Variant p_to, double p_duration); + Ref<IntervalTweener> tween_interval(double p_time); Ref<CallbackTweener> tween_callback(Callable p_callback); - Ref<MethodTweener> tween_method(Callable p_callback, Variant p_from, Variant p_to, float p_duration); + Ref<MethodTweener> tween_method(Callable p_callback, Variant p_from, Variant p_to, double p_duration); void append(Ref<Tweener> p_tweener); - bool custom_step(float p_delta); + bool custom_step(double p_delta); void stop(); void pause(); void play(); @@ -163,13 +163,12 @@ public: Ref<Tween> chain(); static real_t run_equation(TransitionType p_trans_type, EaseType p_ease_type, real_t t, real_t b, real_t c, real_t d); - static Variant interpolate_variant(Variant p_initial_val, Variant p_delta_val, float p_time, float p_duration, Tween::TransitionType p_trans, Tween::EaseType p_ease); - Variant calculate_delta_value(Variant p_intial_val, Variant p_final_val); + static Variant interpolate_variant(Variant p_initial_val, Variant p_delta_val, double p_time, double p_duration, Tween::TransitionType p_trans, Tween::EaseType p_ease); - bool step(float p_delta); + bool step(double p_delta); bool can_process(bool p_tree_paused) const; Node *get_bound_node() const; - float get_total_time() const; + double get_total_time() const; Tween(); Tween(bool p_valid); @@ -189,13 +188,13 @@ public: Ref<PropertyTweener> as_relative(); Ref<PropertyTweener> set_trans(Tween::TransitionType p_trans); Ref<PropertyTweener> set_ease(Tween::EaseType p_ease); - Ref<PropertyTweener> set_delay(float p_delay); + Ref<PropertyTweener> set_delay(double p_delay); void set_tween(Ref<Tween> p_tween) override; void start() override; - bool step(float &r_delta) override; + bool step(double &r_delta) override; - PropertyTweener(Object *p_target, NodePath p_property, Variant p_to, float p_duration); + PropertyTweener(Object *p_target, NodePath p_property, Variant p_to, double p_duration); PropertyTweener(); protected: @@ -209,11 +208,11 @@ private: Variant final_val; Variant delta_val; - float duration = 0; + double duration = 0; Tween::TransitionType trans_type = Tween::TRANS_MAX; // This is set inside set_tween(); Tween::EaseType ease_type = Tween::EASE_MAX; - float delay = 0; + double delay = 0; bool do_continue = true; bool relative = false; }; @@ -223,23 +222,23 @@ class IntervalTweener : public Tweener { public: void start() override; - bool step(float &r_delta) override; + bool step(double &r_delta) override; - IntervalTweener(float p_time); + IntervalTweener(double p_time); IntervalTweener(); private: - float duration = 0; + double duration = 0; }; class CallbackTweener : public Tweener { GDCLASS(CallbackTweener, Tweener); public: - Ref<CallbackTweener> set_delay(float p_delay); + Ref<CallbackTweener> set_delay(double p_delay); void start() override; - bool step(float &r_delta) override; + bool step(double &r_delta) override; CallbackTweener(Callable p_callback); CallbackTweener(); @@ -249,7 +248,7 @@ protected: private: Callable callback; - float delay = 0; + double delay = 0; }; class MethodTweener : public Tweener { @@ -258,21 +257,21 @@ class MethodTweener : public Tweener { public: Ref<MethodTweener> set_trans(Tween::TransitionType p_trans); Ref<MethodTweener> set_ease(Tween::EaseType p_ease); - Ref<MethodTweener> set_delay(float p_delay); + Ref<MethodTweener> set_delay(double p_delay); void set_tween(Ref<Tween> p_tween) override; void start() override; - bool step(float &r_delta) override; + bool step(double &r_delta) override; - MethodTweener(Callable p_callback, Variant p_from, Variant p_to, float p_duration); + MethodTweener(Callable p_callback, Variant p_from, Variant p_to, double p_duration); MethodTweener(); protected: static void _bind_methods(); private: - float duration = 0; - float delay = 0; + double duration = 0; + double delay = 0; Tween::TransitionType trans_type = Tween::TRANS_MAX; Tween::EaseType ease_type = Tween::EASE_MAX; |