public void ImportData(tfxJSONObject json_data) { m_override_default = json_data["m_override_default"].Boolean; m_x_ease = (EasingEquation)(int)json_data["m_x_ease"].Number; m_y_ease = (EasingEquation)(int)json_data["m_y_ease"].Number; m_z_ease = (EasingEquation)(int)json_data["m_z_ease"].Number; }
public void ImportData(JSONObject json_data) { m_override_default = json_data["m_override_default"].Boolean; m_x_ease = (EasingEquation)(int)json_data["m_x_ease"].Number; m_y_ease = (EasingEquation)(int)json_data["m_y_ease"].Number; m_z_ease = (EasingEquation)(int)json_data["m_z_ease"].Number; }
public ContentControl3D() { base.RequestBringIntoView += this.OnRequestBringIntoView; base.CommandBindings.Add(new CommandBinding(RotateCommand, OnRotateCommandExecuted, OnCanExecuteRotateCommand)); _easingEquation = GetEasingEquationFromRotationEasingMode(RotationEasingMode.None); this.IsFrontInView = true; }
void DataValueMorphing(ref ValueData _cur, ValueData _org, ValueData _target, EasingEquation _easingType, float _v) { for (var i = 0; i < 4; i++) { //思考:通过ref能否给结构体赋值=>可以 _cur.data[i] = Mathf.LerpUnclamped(_org.data[i], _target.data[i], EasingManager.GetEaseProgress(_easingType, _v)); } }
private void SetUpEquation(EasingType type) { m_workingType = type; if (type == EasingType.CubicBezier) { m_easingCubicBezier.SetCoefficient(m_bezierPoint1, m_bezierPoint2); m_equation = m_easingCubicBezier.Ease; } else { m_equation = GetEquation(type); } }
IEnumerator IE_OnceMorphing(ISetValue _fun, int _index, ValueData _org, ValueData _target, float _useTime, EasingEquation _easingType) { var _end = false; var _timer = 0f; var _v = 0f; var _cur = new ValueData(); _cur.data = new float[4]; var _type = (MorphingValueType)_index; while (!_end) { if (_v >= 1) { _end = true; } else { _timer += Time.deltaTime; } _v = Mathf.Clamp01(_timer / _useTime); DataValueMorphing(ref _cur, _org, _target, _easingType, _v); _fun.SetValue(_type, _cur); yield return(null); } }
public static double CalculateCurrentValue(double time, double from, double delta, double duration, EasingEquation equation) { switch (equation) { case EasingEquation.BackEaseIn: return(EasingEquations.EaseInBack(time, from, delta, duration)); case EasingEquation.BackEaseInOut: return(EasingEquations.EaseInOutBack(time, from, delta, duration)); case EasingEquation.BackEaseOut: return(EasingEquations.EaseOutBack(time, from, delta, duration)); case EasingEquation.BounceEaseIn: return(EasingEquations.EaseInBounce(time, from, delta, duration)); case EasingEquation.BounceEaseInOut: return(EasingEquations.EaseInOutBounce(time, from, delta, duration)); case EasingEquation.BounceEaseOut: return(EasingEquations.EaseOutBounce(time, from, delta, duration)); case EasingEquation.CircEaseIn: return(EasingEquations.EaseInCirc(time, from, delta, duration)); case EasingEquation.CircEaseInOut: return(EasingEquations.EaseInOutCirc(time, from, delta, duration)); case EasingEquation.CircEaseOut: return(EasingEquations.EaseOutCirc(time, from, delta, duration)); case EasingEquation.CubicEaseIn: return(EasingEquations.EaseInCubic(time, from, delta, duration)); case EasingEquation.CubicEaseInOut: return(EasingEquations.EaseInOutCirc(time, from, delta, duration)); case EasingEquation.CubicEaseOut: return(EasingEquations.EaseOutCirc(time, from, delta, duration)); case EasingEquation.ElasticEaseIn: return(EasingEquations.EaseInElastic(time, from, delta, duration)); case EasingEquation.ElasticEaseInOut: return(EasingEquations.EaseInOutElastic(time, from, delta, duration)); case EasingEquation.ElasticEaseOut: return(EasingEquations.EaseOutElastic(time, from, delta, duration)); case EasingEquation.ExpoEaseIn: return(EasingEquations.EaseInExpo(time, from, delta, duration)); case EasingEquation.ExpoEaseInOut: return(EasingEquations.EaseInOutElastic(time, from, delta, duration)); case EasingEquation.ExpoEaseOut: return(EasingEquations.EaseOutElastic(time, from, delta, duration)); case EasingEquation.Linear: return(EasingEquations.Linear(time, from, delta, duration)); case EasingEquation.QuadEaseIn: return(EasingEquations.EaseInQuad(time, from, delta, duration)); case EasingEquation.QuadEaseInOut: return(EasingEquations.EaseInOutQuad(time, from, delta, duration)); case EasingEquation.QuadEaseOut: return(EasingEquations.EaseOutQuad(time, from, delta, duration)); case EasingEquation.QuartEaseIn: return(EasingEquations.EaseInQuart(time, from, delta, duration)); case EasingEquation.QuartEaseInOut: return(EasingEquations.EaseInOutQuart(time, from, delta, duration)); case EasingEquation.QuartEaseOut: return(EasingEquations.EaseOutQuart(time, from, delta, duration)); case EasingEquation.QuintEaseIn: return(EasingEquations.EaseInQuint(time, from, delta, duration)); case EasingEquation.QuintEaseInOut: return(EasingEquations.EaseInOutQuint(time, from, delta, duration)); case EasingEquation.QuintEaseOut: return(EasingEquations.EaseOutQuint(time, from, delta, duration)); case EasingEquation.SineEaseIn: return(EasingEquations.EaseInSine(time, from, delta, duration)); case EasingEquation.SineEaseInOut: return(EasingEquations.EaseInOutSine(time, from, delta, duration)); case EasingEquation.SineEaseOut: return(EasingEquations.EaseOutSine(time, from, delta, duration)); default: return(Double.MinValue); } }
/// <summary> /// 一个通用的Morphing函数,可以让对象的指定值在一段时间内达到目标值 /// </summary> /// <param name="_fun">调用的对象必须要有ISetValue接口</param> /// <param name="_org">初始值,是个固定长度的数组,但只需要给用到的赋值</param> /// <param name="_target">目标值</param> /// <param name="_useTime">用时</param> /// <param name="_easingType">缓动类型</param> /// <returns></returns> public IEnumerator IE_Morphing(ISetValue _fun, ValueData[] _org, ValueData[] _target, float _useTime = 0.5f, EasingEquation _easingType = EasingEquation.Linear) { for (var i = 0; i < _org.Length; i++) { if (_org[i].use) { StartCoroutine(IE_OnceMorphing(_fun, i, _org[i], _target[i], _useTime, _easingType)); } } yield return(new WaitForSeconds(_useTime)); }
public void SetEased( EasingEquation easing_function, Vector3 eased_from, Vector3 eased_to, Vector3 eased_then) { m_progression_idx = (int) ValueProgression.Eased; m_from = eased_from; m_to = eased_to; m_to_to = eased_then; m_to_to_bool = true; m_ease_type = easing_function; }
protected void ImportBaseData(JSONObject json_data) { m_progression_idx = (int) json_data["m_progression"].Number; m_ease_type = (EasingEquation) (int) json_data["m_ease_type"].Number; m_is_offset_from_last = json_data["m_is_offset_from_last"].Boolean; m_to_to_bool = json_data["m_to_to_bool"].Boolean; m_unique_randoms = json_data["m_unique_randoms"].Boolean; m_animate_per = (AnimatePerOptions) (int) json_data["m_animate_per"].Number; m_override_animate_per_option = json_data["m_override_animate_per_option"].Boolean; if(json_data.ContainsKey("m_custom_ease_curve")) m_custom_ease_curve = json_data["m_custom_ease_curve"].Array.JSONtoAnimationCurve(); }
public void ImportData(JSONObject json_data) { m_action_type = (ACTION_TYPE)(int)json_data["m_action_type"].Number; m_ease_type = (EasingEquation)(int)json_data["m_ease_type"].Number; m_use_gradient_start = json_data["m_use_gradient_start"].Boolean; m_use_gradient_end = json_data["m_use_gradient_end"].Boolean; m_force_same_start_time = json_data["m_force_same_start_time"].Boolean; m_letter_anchor_start = (int)json_data["m_letter_anchor_start"].Number; m_letter_anchor_end = (int)json_data["m_letter_anchor_end"].Number; m_letter_anchor_2_way = json_data["m_letter_anchor_2_way"].Boolean; m_offset_from_last = json_data["m_offset_from_last"].Boolean; m_position_axis_ease_data.ImportData(json_data["m_position_axis_ease_data"].Obj); m_rotation_axis_ease_data.ImportData(json_data["m_rotation_axis_ease_data"].Obj); m_scale_axis_ease_data.ImportData(json_data["m_scale_axis_ease_data"].Obj); if (m_use_gradient_start) m_start_vertex_colour.ImportData(json_data["m_start_vertex_colour"].Obj); else m_start_colour.ImportData(json_data["m_start_colour"].Obj); if (m_use_gradient_end) m_end_vertex_colour.ImportData(json_data["m_end_vertex_colour"].Obj); else m_end_colour.ImportData(json_data["m_end_colour"].Obj); m_start_euler_rotation.ImportData(json_data["m_start_euler_rotation"].Obj); m_end_euler_rotation.ImportData(json_data["m_end_euler_rotation"].Obj); m_start_pos.ImportData(json_data["m_start_pos"].Obj); m_end_pos.ImportData(json_data["m_end_pos"].Obj); m_start_scale.ImportData(json_data["m_start_scale"].Obj); m_end_scale.ImportData(json_data["m_end_scale"].Obj); m_delay_progression.ImportData(json_data["m_delay_progression"].Obj); m_duration_progression.ImportData(json_data["m_duration_progression"].Obj); m_audio_effects = new List<AudioEffectSetup>(); AudioEffectSetup audio_effect; foreach (var audio_data in json_data["AUDIO_EFFECTS_DATA"].Array) { audio_effect = new AudioEffectSetup(); audio_effect.ImportData(audio_data.Obj); m_audio_effects.Add(audio_effect); } m_particle_effects = new List<ParticleEffectSetup>(); ParticleEffectSetup particle_effect; foreach (var particle_data in json_data["PARTICLE_EFFECTS_DATA"].Array) { particle_effect = new ParticleEffectSetup(); particle_effect.ImportData(particle_data.Obj); m_particle_effects.Add(particle_effect); } }
public static EasingEquation GetEaseTypeOpposite(EasingEquation ease_type) { switch(ease_type) { case EasingEquation.Linear: return EasingEquation.Linear; case EasingEquation.BackEaseIn: return EasingEquation.BackEaseOut; case EasingEquation.BackEaseInOut: return EasingEquation.BackEaseOutIn; case EasingEquation.BackEaseOut: return EasingEquation.BackEaseIn; case EasingEquation.BackEaseOutIn: return EasingEquation.BackEaseInOut; case EasingEquation.BounceEaseIn: return EasingEquation.BounceEaseOut; case EasingEquation.BounceEaseInOut: return EasingEquation.BounceEaseOutIn; case EasingEquation.BounceEaseOut: return EasingEquation.BounceEaseIn; case EasingEquation.BounceEaseOutIn: return EasingEquation.BounceEaseInOut; case EasingEquation.CircEaseIn: return EasingEquation.CircEaseOut; case EasingEquation.CircEaseInOut: return EasingEquation.CircEaseOutIn; case EasingEquation.CircEaseOut: return EasingEquation.CircEaseIn; case EasingEquation.CircEaseOutIn: return EasingEquation.CircEaseInOut; case EasingEquation.CubicEaseIn: return EasingEquation.CubicEaseOut; case EasingEquation.CubicEaseInOut: return EasingEquation.CubicEaseOutIn; case EasingEquation.CubicEaseOut: return EasingEquation.CubicEaseIn; case EasingEquation.CubicEaseOutIn: return EasingEquation.CubicEaseInOut; case EasingEquation.ElasticEaseIn: return EasingEquation.ElasticEaseOut; case EasingEquation.ElasticEaseInOut: return EasingEquation.ElasticEaseOutIn; case EasingEquation.ElasticEaseOut: return EasingEquation.ElasticEaseIn; case EasingEquation.ElasticEaseOutIn: return EasingEquation.ElasticEaseInOut; case EasingEquation.ExpoEaseIn: return EasingEquation.ExpoEaseOut; case EasingEquation.ExpoEaseInOut: return EasingEquation.ExpoEaseOutIn; case EasingEquation.ExpoEaseOut: return EasingEquation.ExpoEaseIn; case EasingEquation.ExpoEaseOutIn: return EasingEquation.ExpoEaseInOut; case EasingEquation.QuadEaseIn: return EasingEquation.QuadEaseOut; case EasingEquation.QuadEaseInOut: return EasingEquation.QuadEaseOutIn; case EasingEquation.QuadEaseOut: return EasingEquation.QuadEaseIn; case EasingEquation.QuadEaseOutIn: return EasingEquation.QuadEaseInOut; case EasingEquation.QuartEaseIn: return EasingEquation.QuartEaseOut; case EasingEquation.QuartEaseInOut: return EasingEquation.QuartEaseOutIn; case EasingEquation.QuartEaseOut: return EasingEquation.QuartEaseIn; case EasingEquation.QuartEaseOutIn: return EasingEquation.QuartEaseInOut; case EasingEquation.QuintEaseIn: return EasingEquation.QuintEaseOut; case EasingEquation.QuintEaseInOut: return EasingEquation.QuintEaseOutIn; case EasingEquation.QuintEaseOut: return EasingEquation.QuintEaseIn; case EasingEquation.QuintEaseOutIn: return EasingEquation.QuintEaseInOut; case EasingEquation.SineEaseIn: return EasingEquation.SineEaseOut; case EasingEquation.SineEaseInOut: return EasingEquation.SineEaseOutIn; case EasingEquation.SineEaseOut: return EasingEquation.SineEaseIn; case EasingEquation.SineEaseOutIn: return EasingEquation.SineEaseInOut; default : return EasingEquation.Linear; } }
public static EasingEquation GetEaseTypeOpposite(EasingEquation ease_type) { switch (ease_type) { case EasingEquation.Linear: return(EasingEquation.Linear); case EasingEquation.BackEaseIn: return(EasingEquation.BackEaseOut); case EasingEquation.BackEaseInOut: return(EasingEquation.BackEaseOutIn); case EasingEquation.BackEaseOut: return(EasingEquation.BackEaseIn); case EasingEquation.BackEaseOutIn: return(EasingEquation.BackEaseInOut); case EasingEquation.BounceEaseIn: return(EasingEquation.BounceEaseOut); case EasingEquation.BounceEaseInOut: return(EasingEquation.BounceEaseOutIn); case EasingEquation.BounceEaseOut: return(EasingEquation.BounceEaseIn); case EasingEquation.BounceEaseOutIn: return(EasingEquation.BounceEaseInOut); case EasingEquation.CircEaseIn: return(EasingEquation.CircEaseOut); case EasingEquation.CircEaseInOut: return(EasingEquation.CircEaseOutIn); case EasingEquation.CircEaseOut: return(EasingEquation.CircEaseIn); case EasingEquation.CircEaseOutIn: return(EasingEquation.CircEaseInOut); case EasingEquation.CubicEaseIn: return(EasingEquation.CubicEaseOut); case EasingEquation.CubicEaseInOut: return(EasingEquation.CubicEaseOutIn); case EasingEquation.CubicEaseOut: return(EasingEquation.CubicEaseIn); case EasingEquation.CubicEaseOutIn: return(EasingEquation.CubicEaseInOut); case EasingEquation.ElasticEaseIn: return(EasingEquation.ElasticEaseOut); case EasingEquation.ElasticEaseInOut: return(EasingEquation.ElasticEaseOutIn); case EasingEquation.ElasticEaseOut: return(EasingEquation.ElasticEaseIn); case EasingEquation.ElasticEaseOutIn: return(EasingEquation.ElasticEaseInOut); case EasingEquation.ExpoEaseIn: return(EasingEquation.ExpoEaseOut); case EasingEquation.ExpoEaseInOut: return(EasingEquation.ExpoEaseOutIn); case EasingEquation.ExpoEaseOut: return(EasingEquation.ExpoEaseIn); case EasingEquation.ExpoEaseOutIn: return(EasingEquation.ExpoEaseInOut); case EasingEquation.QuadEaseIn: return(EasingEquation.QuadEaseOut); case EasingEquation.QuadEaseInOut: return(EasingEquation.QuadEaseOutIn); case EasingEquation.QuadEaseOut: return(EasingEquation.QuadEaseIn); case EasingEquation.QuadEaseOutIn: return(EasingEquation.QuadEaseInOut); case EasingEquation.QuartEaseIn: return(EasingEquation.QuartEaseOut); case EasingEquation.QuartEaseInOut: return(EasingEquation.QuartEaseOutIn); case EasingEquation.QuartEaseOut: return(EasingEquation.QuartEaseIn); case EasingEquation.QuartEaseOutIn: return(EasingEquation.QuartEaseInOut); case EasingEquation.QuintEaseIn: return(EasingEquation.QuintEaseOut); case EasingEquation.QuintEaseInOut: return(EasingEquation.QuintEaseOutIn); case EasingEquation.QuintEaseOut: return(EasingEquation.QuintEaseIn); case EasingEquation.QuintEaseOutIn: return(EasingEquation.QuintEaseInOut); case EasingEquation.SineEaseIn: return(EasingEquation.SineEaseOut); case EasingEquation.SineEaseInOut: return(EasingEquation.SineEaseOutIn); case EasingEquation.SineEaseOut: return(EasingEquation.SineEaseIn); case EasingEquation.SineEaseOutIn: return(EasingEquation.SineEaseInOut); default: return(EasingEquation.Linear); } }
/// <summary> /// Define a callback to use for all easing calculations. /// </summary> /// <param name="callback">Delegate to use for each easing calculation.</param> public void EasingCallback(EasingEquation callback) { _easing.EasingEquation = callback; }
public static double CalculateCurrentValue(double time, double from, double delta, double duration, EasingEquation equation) { switch (equation) { case EasingEquation.BackEaseIn: return EasingEquations.EaseInBack(time, from, delta, duration); case EasingEquation.BackEaseInOut: return EasingEquations.EaseInOutBack(time, from, delta, duration); case EasingEquation.BackEaseOut: return EasingEquations.EaseOutBack(time, from, delta, duration); case EasingEquation.BounceEaseIn: return EasingEquations.EaseInBounce(time, from, delta, duration); case EasingEquation.BounceEaseInOut: return EasingEquations.EaseInOutBounce(time, from, delta, duration); case EasingEquation.BounceEaseOut: return EasingEquations.EaseOutBounce(time, from, delta, duration); case EasingEquation.CircEaseIn: return EasingEquations.EaseInCirc(time, from, delta, duration); case EasingEquation.CircEaseInOut: return EasingEquations.EaseInOutCirc(time, from, delta, duration); case EasingEquation.CircEaseOut: return EasingEquations.EaseOutCirc(time, from, delta, duration); case EasingEquation.CubicEaseIn: return EasingEquations.EaseInCubic(time, from, delta, duration); case EasingEquation.CubicEaseInOut: return EasingEquations.EaseInOutCirc(time, from, delta, duration); case EasingEquation.CubicEaseOut: return EasingEquations.EaseOutCirc(time, from, delta, duration); case EasingEquation.ElasticEaseIn: return EasingEquations.EaseInElastic(time, from, delta, duration); case EasingEquation.ElasticEaseInOut: return EasingEquations.EaseInOutElastic(time, from, delta, duration); case EasingEquation.ElasticEaseOut: return EasingEquations.EaseOutElastic(time, from, delta, duration); case EasingEquation.ExpoEaseIn: return EasingEquations.EaseInExpo(time, from, delta, duration); case EasingEquation.ExpoEaseInOut: return EasingEquations.EaseInOutElastic(time, from, delta, duration); case EasingEquation.ExpoEaseOut: return EasingEquations.EaseOutElastic(time, from, delta, duration); case EasingEquation.Linear: return EasingEquations.Linear(time, from, delta, duration); case EasingEquation.QuadEaseIn: return EasingEquations.EaseInQuad(time, from, delta, duration); case EasingEquation.QuadEaseInOut: return EasingEquations.EaseInOutQuad(time, from, delta, duration); case EasingEquation.QuadEaseOut: return EasingEquations.EaseOutQuad(time, from, delta, duration); case EasingEquation.QuartEaseIn: return EasingEquations.EaseInQuart(time, from, delta, duration); case EasingEquation.QuartEaseInOut: return EasingEquations.EaseInOutQuart(time, from, delta, duration); case EasingEquation.QuartEaseOut: return EasingEquations.EaseOutQuart(time, from, delta, duration); case EasingEquation.QuintEaseIn: return EasingEquations.EaseInQuint(time, from, delta, duration); case EasingEquation.QuintEaseInOut: return EasingEquations.EaseInOutQuint(time, from, delta, duration); case EasingEquation.QuintEaseOut: return EasingEquations.EaseOutQuint(time, from, delta, duration); case EasingEquation.SineEaseIn: return EasingEquations.EaseInSine(time, from, delta, duration); case EasingEquation.SineEaseInOut: return EasingEquations.EaseInOutSine(time, from, delta, duration); case EasingEquation.SineEaseOut: return EasingEquations.EaseOutSine(time, from, delta, duration); default: return Double.MinValue; } }
public void ImportData(Boomlagoon.JSON.JSONObject json_data, string assetNameSuffix = "", float timing_scale = -1) { m_action_type = (ACTION_TYPE) (int) json_data["m_action_type"].Number; m_ease_type = (EasingEquation) (int) json_data["m_ease_type"].Number; m_force_same_start_time = json_data["m_force_same_start_time"].Boolean; m_letter_anchor_start = (int) json_data["m_letter_anchor_start"].Number; m_letter_anchor_end = (int) json_data["m_letter_anchor_end"].Number; m_letter_anchor_2_way = json_data["m_letter_anchor_2_way"].Boolean; m_offset_from_last = json_data["m_offset_from_last"].Boolean; m_position_axis_ease_data.ImportData(json_data["m_position_axis_ease_data"].Obj); m_rotation_axis_ease_data.ImportData(json_data["m_rotation_axis_ease_data"].Obj); m_scale_axis_ease_data.ImportData(json_data["m_scale_axis_ease_data"].Obj); m_colour_transition_active = json_data.ContainsKey("m_colour_transition_active") ? json_data ["m_colour_transition_active"].Boolean : true; m_position_transition_active = json_data.ContainsKey("m_position_transition_active") ? json_data ["m_position_transition_active"].Boolean : true; m_local_rotation_transition_active = json_data.ContainsKey("m_local_rotation_transition_active") ? json_data ["m_local_rotation_transition_active"].Boolean : true; m_local_scale_transition_active = json_data.ContainsKey("m_local_scale_transition_active") ? json_data ["m_local_scale_transition_active"].Boolean : true; m_global_rotation_transition_active = json_data.ContainsKey("m_global_rotation_transition_active") ? json_data ["m_global_rotation_transition_active"].Boolean : true; m_global_scale_transition_active = json_data.ContainsKey("m_global_scale_transition_active") ? json_data ["m_global_scale_transition_active"].Boolean : true; if(json_data.ContainsKey("m_start_colour")) m_start_colour.ImportData(json_data["m_start_colour"].Obj); if(json_data.ContainsKey("m_end_colour")) m_end_colour.ImportData(json_data["m_end_colour"].Obj); if(json_data.ContainsKey("m_start_vertex_colour")) m_start_colour.ImportData(json_data["m_start_vertex_colour"].Obj); if(json_data.ContainsKey("m_end_vertex_colour")) m_start_colour.ImportData(json_data["m_end_vertex_colour"].Obj); if(json_data.ContainsKey("m_use_gradient_start")) // Legacy setting. Need to check for it for backwards compatibility m_start_colour.UseColourGradients = json_data["m_use_gradient_start"].Boolean; if(json_data.ContainsKey("m_use_gradient_end")) // Legacy setting. Need to check for it for backwards compatibility m_end_colour.UseColourGradients = json_data["m_use_gradient_end"].Boolean; m_start_pos.ImportData(json_data["m_start_pos"].Obj); m_end_pos.ImportData(json_data["m_end_pos"].Obj); m_start_euler_rotation.ImportData(json_data["m_start_euler_rotation"].Obj); m_end_euler_rotation.ImportData(json_data["m_end_euler_rotation"].Obj); m_start_scale.ImportData(json_data["m_start_scale"].Obj); m_end_scale.ImportData(json_data["m_end_scale"].Obj); m_global_start_euler_rotation.ImportData(json_data["m_global_start_euler_rotation"].Obj); m_global_end_euler_rotation.ImportData(json_data["m_global_end_euler_rotation"].Obj); m_global_start_scale.ImportData(json_data["m_global_start_scale"].Obj); m_global_end_scale.ImportData(json_data["m_global_end_scale"].Obj); m_duration_progression.ImportData(json_data["m_duration_progression"].Obj); m_delay_progression.ImportData(json_data["m_delay_progression"].Obj); if(timing_scale != -1) { // Scale delay easing by the provided timing scale if(m_delay_progression.Progression != (int) ValueProgression.Constant) { float from = m_delay_progression.ValueFrom; float to = m_delay_progression.ValueTo; float then = m_delay_progression.ValueThen; if(m_delay_progression.Progression == (int) ValueProgression.Eased) { if(m_delay_progression.UsingThirdValue) m_delay_progression.SetEased( from * timing_scale, to * timing_scale, then * timing_scale); else m_delay_progression.SetEased( from * timing_scale, to * timing_scale); } else if(m_delay_progression.Progression == (int) ValueProgression.EasedCustom) { m_delay_progression.SetEasedCustom( from * timing_scale, to * timing_scale); } else if(m_delay_progression.Progression == (int) ValueProgression.Random) { m_delay_progression.SetRandom( from * timing_scale, to * timing_scale, m_delay_progression.UniqueRandomRaw); } } } m_audio_effects = new List<AudioEffectSetup>(); AudioEffectSetup audio_effect; foreach(Boomlagoon.JSON.JSONValue audio_data in json_data["AUDIO_EFFECTS_DATA"].Array) { audio_effect = new AudioEffectSetup(); audio_effect.ImportData(audio_data.Obj); m_audio_effects.Add(audio_effect); } m_particle_effects = new List<ParticleEffectSetup>(); ParticleEffectSetup particle_effect; foreach(Boomlagoon.JSON.JSONValue particle_data in json_data["PARTICLE_EFFECTS_DATA"].Array) { particle_effect = new ParticleEffectSetup(); particle_effect.ImportData(particle_data.Obj, assetNameSuffix); m_particle_effects.Add(particle_effect); } }
public void SetEased( VertexColour eased_from, VertexColour eased_to, EasingEquation easing_function) { m_progression_idx = (int) ValueProgression.Eased; m_from = eased_from; m_to = eased_to; m_to_to_bool = false; m_ease_type = easing_function; }
public static float GetEaseProgress(EasingEquation ease_type, float linear_progress) { switch(ease_type) { case EasingEquation.Linear: return linear_progress; case EasingEquation.BackEaseIn: return EasingManager.BackEaseIn(linear_progress, 0, 1, 1); case EasingEquation.BackEaseInOut: return EasingManager.BackEaseInOut(linear_progress, 0, 1, 1); case EasingEquation.BackEaseOut: return EasingManager.BackEaseOut(linear_progress, 0, 1, 1); case EasingEquation.BackEaseOutIn: return EasingManager.BackEaseOutIn(linear_progress, 0, 1, 1); case EasingEquation.BounceEaseIn: return EasingManager.BounceEaseIn(linear_progress, 0, 1, 1); case EasingEquation.BounceEaseInOut: return EasingManager.BounceEaseInOut(linear_progress, 0, 1, 1); case EasingEquation.BounceEaseOut: return EasingManager.BounceEaseOut(linear_progress, 0, 1, 1); case EasingEquation.BounceEaseOutIn: return EasingManager.BounceEaseOutIn(linear_progress, 0, 1, 1); case EasingEquation.CircEaseIn: return EasingManager.CircEaseIn(linear_progress, 0, 1, 1); case EasingEquation.CircEaseInOut: return EasingManager.CircEaseInOut(linear_progress, 0, 1, 1); case EasingEquation.CircEaseOut: return EasingManager.CircEaseOut(linear_progress, 0, 1, 1); case EasingEquation.CircEaseOutIn: return EasingManager.CircEaseOutIn(linear_progress, 0, 1, 1); case EasingEquation.CubicEaseIn: return EasingManager.CubicEaseIn(linear_progress, 0, 1, 1); case EasingEquation.CubicEaseInOut: return EasingManager.CubicEaseInOut(linear_progress, 0, 1, 1); case EasingEquation.CubicEaseOut: return EasingManager.CubicEaseOut(linear_progress, 0, 1, 1); case EasingEquation.CubicEaseOutIn: return EasingManager.CubicEaseOutIn(linear_progress, 0, 1, 1); case EasingEquation.ElasticEaseIn: return EasingManager.ElasticEaseIn(linear_progress, 0, 1, 1); case EasingEquation.ElasticEaseInOut: return EasingManager.ElasticEaseInOut(linear_progress, 0, 1, 1); case EasingEquation.ElasticEaseOut: return EasingManager.ElasticEaseOut(linear_progress, 0, 1, 1); case EasingEquation.ElasticEaseOutIn: return EasingManager.ElasticEaseOutIn(linear_progress, 0, 1, 1); case EasingEquation.ExpoEaseIn: return EasingManager.ExpoEaseIn(linear_progress, 0, 1, 1); case EasingEquation.ExpoEaseInOut: return EasingManager.ExpoEaseInOut(linear_progress, 0, 1, 1); case EasingEquation.ExpoEaseOut: return EasingManager.ExpoEaseOut(linear_progress, 0, 1, 1); case EasingEquation.ExpoEaseOutIn: return EasingManager.ExpoEaseOutIn(linear_progress, 0, 1, 1); case EasingEquation.QuadEaseIn: return EasingManager.QuadEaseIn(linear_progress, 0, 1, 1); case EasingEquation.QuadEaseInOut: return EasingManager.QuadEaseInOut(linear_progress, 0, 1, 1); case EasingEquation.QuadEaseOut: return EasingManager.QuadEaseOut(linear_progress, 0, 1, 1); case EasingEquation.QuadEaseOutIn: return EasingManager.QuadEaseOutIn(linear_progress, 0, 1, 1); case EasingEquation.QuartEaseIn: return EasingManager.QuartEaseIn(linear_progress, 0, 1, 1); case EasingEquation.QuartEaseInOut: return EasingManager.QuartEaseInOut(linear_progress, 0, 1, 1); case EasingEquation.QuartEaseOut: return EasingManager.QuartEaseOut(linear_progress, 0, 1, 1); case EasingEquation.QuartEaseOutIn: return EasingManager.QuartEaseOutIn(linear_progress, 0, 1, 1); case EasingEquation.QuintEaseIn: return EasingManager.QuintEaseIn(linear_progress, 0, 1, 1); case EasingEquation.QuintEaseInOut: return EasingManager.QuintEaseInOut(linear_progress, 0, 1, 1); case EasingEquation.QuintEaseOut: return EasingManager.QuintEaseOut(linear_progress, 0, 1, 1); case EasingEquation.QuintEaseOutIn: return EasingManager.QuintEaseOutIn(linear_progress, 0, 1, 1); case EasingEquation.SineEaseIn: return EasingManager.SineEaseIn(linear_progress, 0, 1, 1); case EasingEquation.SineEaseInOut: return EasingManager.SineEaseInOut(linear_progress, 0, 1, 1); case EasingEquation.SineEaseOut: return EasingManager.SineEaseOut(linear_progress, 0, 1, 1); case EasingEquation.SineEaseOutIn: return EasingManager.SineEaseOutIn(linear_progress, 0, 1, 1); default : return linear_progress; } }
public void ImportBaseLagacyData(KeyValuePair<string, string> value_pair) { switch(value_pair.Key) { case "m_progression": m_progression_idx = int.Parse(value_pair.Value); break; case "m_ease_type": m_ease_type = (EasingEquation) int.Parse(value_pair.Value); break; case "m_is_offset_from_last": m_is_offset_from_last = bool.Parse(value_pair.Value); break; case "m_to_to_bool": m_to_to_bool = bool.Parse(value_pair.Value); break; case "m_unique_randoms": m_unique_randoms = bool.Parse(value_pair.Value); break; case "m_animate_per": m_animate_per = (AnimatePerOptions) int.Parse(value_pair.Value); break; case "m_override_animate_per_option": m_override_animate_per_option = bool.Parse(value_pair.Value); break; case "m_custom_ease_curve": m_custom_ease_curve = value_pair.Value.ToAnimationCurve(); break; } }
public static float GetEaseProgress(EasingEquation ease_type, float linear_progress) { switch (ease_type) { case EasingEquation.Linear: return(linear_progress); case EasingEquation.BackEaseIn: return(EasingManager.BackEaseIn(linear_progress, 0, 1, 1)); case EasingEquation.BackEaseInOut: return(EasingManager.BackEaseInOut(linear_progress, 0, 1, 1)); case EasingEquation.BackEaseOut: return(EasingManager.BackEaseOut(linear_progress, 0, 1, 1)); case EasingEquation.BackEaseOutIn: return(EasingManager.BackEaseOutIn(linear_progress, 0, 1, 1)); case EasingEquation.BounceEaseIn: return(EasingManager.BounceEaseIn(linear_progress, 0, 1, 1)); case EasingEquation.BounceEaseInOut: return(EasingManager.BounceEaseInOut(linear_progress, 0, 1, 1)); case EasingEquation.BounceEaseOut: return(EasingManager.BounceEaseOut(linear_progress, 0, 1, 1)); case EasingEquation.BounceEaseOutIn: return(EasingManager.BounceEaseOutIn(linear_progress, 0, 1, 1)); case EasingEquation.CircEaseIn: return(EasingManager.CircEaseIn(linear_progress, 0, 1, 1)); case EasingEquation.CircEaseInOut: return(EasingManager.CircEaseInOut(linear_progress, 0, 1, 1)); case EasingEquation.CircEaseOut: return(EasingManager.CircEaseOut(linear_progress, 0, 1, 1)); case EasingEquation.CircEaseOutIn: return(EasingManager.CircEaseOutIn(linear_progress, 0, 1, 1)); case EasingEquation.CubicEaseIn: return(EasingManager.CubicEaseIn(linear_progress, 0, 1, 1)); case EasingEquation.CubicEaseInOut: return(EasingManager.CubicEaseInOut(linear_progress, 0, 1, 1)); case EasingEquation.CubicEaseOut: return(EasingManager.CubicEaseOut(linear_progress, 0, 1, 1)); case EasingEquation.CubicEaseOutIn: return(EasingManager.CubicEaseOutIn(linear_progress, 0, 1, 1)); case EasingEquation.ElasticEaseIn: return(EasingManager.ElasticEaseIn(linear_progress, 0, 1, 1)); case EasingEquation.ElasticEaseInOut: return(EasingManager.ElasticEaseInOut(linear_progress, 0, 1, 1)); case EasingEquation.ElasticEaseOut: return(EasingManager.ElasticEaseOut(linear_progress, 0, 1, 1)); case EasingEquation.ElasticEaseOutIn: return(EasingManager.ElasticEaseOutIn(linear_progress, 0, 1, 1)); case EasingEquation.ExpoEaseIn: return(EasingManager.ExpoEaseIn(linear_progress, 0, 1, 1)); case EasingEquation.ExpoEaseInOut: return(EasingManager.ExpoEaseInOut(linear_progress, 0, 1, 1)); case EasingEquation.ExpoEaseOut: return(EasingManager.ExpoEaseOut(linear_progress, 0, 1, 1)); case EasingEquation.ExpoEaseOutIn: return(EasingManager.ExpoEaseOutIn(linear_progress, 0, 1, 1)); case EasingEquation.QuadEaseIn: return(EasingManager.QuadEaseIn(linear_progress, 0, 1, 1)); case EasingEquation.QuadEaseInOut: return(EasingManager.QuadEaseInOut(linear_progress, 0, 1, 1)); case EasingEquation.QuadEaseOut: return(EasingManager.QuadEaseOut(linear_progress, 0, 1, 1)); case EasingEquation.QuadEaseOutIn: return(EasingManager.QuadEaseOutIn(linear_progress, 0, 1, 1)); case EasingEquation.QuartEaseIn: return(EasingManager.QuartEaseIn(linear_progress, 0, 1, 1)); case EasingEquation.QuartEaseInOut: return(EasingManager.QuartEaseInOut(linear_progress, 0, 1, 1)); case EasingEquation.QuartEaseOut: return(EasingManager.QuartEaseOut(linear_progress, 0, 1, 1)); case EasingEquation.QuartEaseOutIn: return(EasingManager.QuartEaseOutIn(linear_progress, 0, 1, 1)); case EasingEquation.QuintEaseIn: return(EasingManager.QuintEaseIn(linear_progress, 0, 1, 1)); case EasingEquation.QuintEaseInOut: return(EasingManager.QuintEaseInOut(linear_progress, 0, 1, 1)); case EasingEquation.QuintEaseOut: return(EasingManager.QuintEaseOut(linear_progress, 0, 1, 1)); case EasingEquation.QuintEaseOutIn: return(EasingManager.QuintEaseOutIn(linear_progress, 0, 1, 1)); case EasingEquation.SineEaseIn: return(EasingManager.SineEaseIn(linear_progress, 0, 1, 1)); case EasingEquation.SineEaseInOut: return(EasingManager.SineEaseInOut(linear_progress, 0, 1, 1)); case EasingEquation.SineEaseOut: return(EasingManager.SineEaseOut(linear_progress, 0, 1, 1)); case EasingEquation.SineEaseOutIn: return(EasingManager.SineEaseOutIn(linear_progress, 0, 1, 1)); default: return(linear_progress); } }
public float DrawProgressionEditorHeader(GUIContent label, Rect position, bool offset_legal, bool unique_randoms_legal, bool bold_label = true, string[] extra_options = null, int[] extra_option_indexes = null) { float x_offset = position.x; float y_offset = position.y; if(bold_label) { EditorGUI.LabelField(new Rect(x_offset, y_offset, position.width, LINE_HEIGHT), label, EditorStyles.boldLabel); } else { EditorGUI.LabelField(new Rect(x_offset, y_offset, position.width, LINE_HEIGHT), label); } x_offset += PROGRESSION_HEADER_LABEL_WIDTH; string[] options = Enum.GetNames( typeof(ValueProgression) ); int[] option_indexes = PROGRESSION_ENUM_VALUES; if(extra_options != null && extra_option_indexes != null && extra_options.Length > 0 && extra_options.Length == extra_option_indexes.Length) { int original_length = options.Length; Array.Resize<string>(ref options, options.Length + extra_options.Length); Array.Copy(extra_options, 0, options, original_length, extra_options.Length); original_length = option_indexes.Length; Array.Resize<int>(ref option_indexes, option_indexes.Length + extra_option_indexes.Length); Array.Copy(extra_option_indexes, 0, option_indexes, original_length, extra_option_indexes.Length); } m_progression_idx = EditorGUI.IntPopup(new Rect(x_offset, y_offset, ENUM_SELECTOR_WIDTH_SMALL + 18, LINE_HEIGHT), Progression, options, option_indexes); x_offset += ENUM_SELECTOR_WIDTH_SMALL + 25; if(m_progression_idx == (int) ValueProgression.Eased) { EditorGUI.LabelField(new Rect(x_offset, y_offset, position.width, LINE_HEIGHT), new GUIContent("Function :", "Easing function used to lerp values between 'from' and 'to'.")); x_offset += 65; m_ease_type = (EasingEquation) EditorGUI.EnumPopup(new Rect(x_offset, y_offset, ENUM_SELECTOR_WIDTH_MEDIUM, LINE_HEIGHT), m_ease_type); x_offset += ENUM_SELECTOR_WIDTH_MEDIUM + 10; EditorGUI.LabelField(new Rect(x_offset, y_offset, position.width, LINE_HEIGHT), new GUIContent("3rd?", "Option to add a third state to lerp values between.")); x_offset += 35; m_to_to_bool = EditorGUI.Toggle(new Rect(x_offset, y_offset, ENUM_SELECTOR_WIDTH_MEDIUM, LINE_HEIGHT), m_to_to_bool); } else if(m_progression_idx == (int) ValueProgression.Random && unique_randoms_legal) { m_unique_randoms = EditorGUI.Toggle(new Rect(x_offset, y_offset, 200, LINE_HEIGHT), new GUIContent("Unique Randoms?", "Denotes whether a new random value will be picked each time this action is repeated (like when in a loop)."), m_unique_randoms); } y_offset += LINE_HEIGHT; if(offset_legal) { m_is_offset_from_last = EditorGUI.Toggle(new Rect(position.x + ACTION_INDENT_LEVEL_1, y_offset, 200, LINE_HEIGHT), new GUIContent("Offset From Last?", "Denotes whether this value will offset from whatever value it had in the last state. End states offset the start state. Start states offset the previous actions end state."), m_is_offset_from_last); y_offset += LINE_HEIGHT; } if((m_progression_idx == (int) ValueProgression.Eased || m_progression_idx == (int) ValueProgression.Random)) { m_override_animate_per_option = EditorGUI.Toggle(new Rect(position.x + ACTION_INDENT_LEVEL_1, y_offset, 200, LINE_HEIGHT), new GUIContent("Override AnimatePer?", "Denotes whether this state value progression will use the global 'Animate Per' setting, or define its own."), m_override_animate_per_option); if(m_override_animate_per_option) { m_animate_per = (AnimatePerOptions) EditorGUI.EnumPopup(new Rect(position.x + ACTION_INDENT_LEVEL_1 + 200, y_offset, ENUM_SELECTOR_WIDTH_SMALL, LINE_HEIGHT), m_animate_per); } y_offset += LINE_HEIGHT; } else { m_override_animate_per_option = false; } return position.y + (y_offset - position.y); }
public void ImportData(JSONObject json_data) { m_action_type = (ACTION_TYPE)(int)json_data["m_action_type"].Number; m_ease_type = (EasingEquation)(int)json_data["m_ease_type"].Number; m_use_gradient_start = json_data["m_use_gradient_start"].Boolean; m_use_gradient_end = json_data["m_use_gradient_end"].Boolean; m_force_same_start_time = json_data["m_force_same_start_time"].Boolean; m_letter_anchor_start = (int)json_data["m_letter_anchor_start"].Number; m_letter_anchor_end = (int)json_data["m_letter_anchor_end"].Number; m_letter_anchor_2_way = json_data["m_letter_anchor_2_way"].Boolean; m_offset_from_last = json_data["m_offset_from_last"].Boolean; m_position_axis_ease_data.ImportData(json_data["m_position_axis_ease_data"].Obj); m_rotation_axis_ease_data.ImportData(json_data["m_rotation_axis_ease_data"].Obj); m_scale_axis_ease_data.ImportData(json_data["m_scale_axis_ease_data"].Obj); if (m_use_gradient_start) { m_start_vertex_colour.ImportData(json_data["m_start_vertex_colour"].Obj); } else { m_start_colour.ImportData(json_data["m_start_colour"].Obj); } if (m_use_gradient_end) { m_end_vertex_colour.ImportData(json_data["m_end_vertex_colour"].Obj); } else { m_end_colour.ImportData(json_data["m_end_colour"].Obj); } m_start_euler_rotation.ImportData(json_data["m_start_euler_rotation"].Obj); m_end_euler_rotation.ImportData(json_data["m_end_euler_rotation"].Obj); m_start_pos.ImportData(json_data["m_start_pos"].Obj); m_end_pos.ImportData(json_data["m_end_pos"].Obj); m_start_scale.ImportData(json_data["m_start_scale"].Obj); m_end_scale.ImportData(json_data["m_end_scale"].Obj); m_delay_progression.ImportData(json_data["m_delay_progression"].Obj); m_duration_progression.ImportData(json_data["m_duration_progression"].Obj); m_audio_effects = new List <AudioEffectSetup>(); AudioEffectSetup audio_effect; foreach (JSONValue audio_data in json_data["AUDIO_EFFECTS_DATA"].Array) { audio_effect = new AudioEffectSetup(); audio_effect.ImportData(audio_data.Obj); m_audio_effects.Add(audio_effect); } m_particle_effects = new List <ParticleEffectSetup>(); ParticleEffectSetup particle_effect; foreach (JSONValue particle_data in json_data["PARTICLE_EFFECTS_DATA"].Array) { particle_effect = new ParticleEffectSetup(); particle_effect.ImportData(particle_data.Obj); m_particle_effects.Add(particle_effect); } }
public void SetEased( EasingEquation easing_function, float eased_from, float eased_to) { m_progression_idx = (int) ValueProgression.Eased; m_from = eased_from; m_to = eased_to; m_to_to_bool = false; m_ease_type = easing_function; }