コード例 #1
0
ファイル: Tween.cs プロジェクト: MariusUtheim/GRaff
 public Tween(TweenFunction tweeningFunction, int duration, Action <double> stepAction, Action?completeAction)
 {
     Duration         = duration;
     TweeningFunction = tweeningFunction;
     Step            += (sender, e) => stepAction(e.Amount);
     Complete        += (sender, e) => completeAction?.Invoke();
 }
コード例 #2
0
    /// <summary>
    /// Position tweening animation
    /// </summary>
    /// <param name="callback"></param>
    /// <returns></returns>
    IEnumerator UpdatePosition(System.Action <bool> callback)
    {
        float tweenDuration;

        EasingFunction.Ease tweenFunction;

        if (segmentEnabled)
        {
            tweenDuration = tweenInDuraction;
            tweenFunction = tweenEaseInFunction;
        }
        else
        {
            tweenDuration = tweenOutDuraction;
            tweenFunction = tweenEaseOutFunction;
        }

        for (float elaspedTime = 0.0f; elaspedTime <= tweenDuration; elaspedTime += Time.deltaTime)
        {
            float progress = elaspedTime / tweenDuration;

            float easeExpression = EasingFunction.GetEasingFunction(tweenFunction)(0.0f, 1.0f, progress);

            transform.position = Vector3.LerpUnclamped(previousPosition, targetPosition, easeExpression);

            yield return(null);
        }

        transform.position = targetPosition;

        yield return(null);

        callback(true);
    }
コード例 #3
0
        public static Audio.Handle FadeIn(string sound, bool looped, float duration, TweenFunction function = null, float volume = -1)
        {
#if !NOAUDIO
            if (!HasAudio)
            {
                return(default(Audio.Handle));
            }
            sound = sound.Trim().ToLower();
            if (function == null)
            {
                function = TweenFunctions.Linear;
            }

            var info   = Audio.Instance.audiolist[sound];
            var handle = Play(sound, 0.00001f);
            if (handle == null || !handle.Success)
            {
                return(handle);
            }

            handle.Instance.IsLooped = looped;

            handle.FadeState    = 1;
            handle.FadeDuration = handle.FadeTimer = duration;
            handle.FadeFunction = function;
            handle.FadeVolume   = Audio.Volume(volume, info);

            return(handle);
#else
            return(default(Audio.Handle));
#endif
        }
コード例 #4
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
コード例 #5
0
ファイル: RedTween.cs プロジェクト: crawson7/CodeClass
        public static Set StepFunction(TweenFunction function, float time, EaseType ease, System.Action endAction = null, float delay = 0f)
        {
            Set set = new Set("Instant Step Clip", endAction);

            set.Track(1).AddStepFunction(function, time, ease, null);
            set.Play();
            return(set);
        }
コード例 #6
0
ファイル: RedTween.cs プロジェクト: crawson7/CodeClass
            public FunctionClip AddStepFunction(TweenFunction func, float time, EaseType ease, System.Action endAction = null)
            {
                FunctionClip functionClip = new FunctionClip(this, func, time, ease, endAction);

                mClips.Add(functionClip);
                Register(functionClip);
                return(functionClip);
            }
コード例 #7
0
ファイル: TweenTest.cs プロジェクト: MariusUtheim/GRaff
 public void OnKeyPress(Key key)
 {
     if (functions.ContainsKey(key))
     {
         Window.Title = $"TweenTest - Fps: {Time.Fps} - {functionNames[key]}";
         f            = functions[key];
     }
 }
コード例 #8
0
 public void Construct(double start, double end, double time, TweenFunction tweenF)
 {
     _distance      = end - start;
     _original      = start;
     _current       = start;
     _totalDuration = time;
     _tweenF        = tweenF;
 }
コード例 #9
0
ファイル: Tween.cs プロジェクト: KelvinCoding/SevenEngine
 public void Construct(float start, float end, float time, TweenFunction tweenF)
 {
     _distance = end - start;
       _original = start;
       _current = start;
       _totalDuration = time;
       _tweenF = tweenF;
 }
コード例 #10
0
ファイル: Tween.cs プロジェクト: beamery/bTris
 public Tween(double start, double end, double time, TweenFunction tweenF)
 {
     distance = end - start;
     original = start;
     current = start;
     totalDuration = time;
     this.tweenF = tweenF;
 }
コード例 #11
0
ファイル: Tween.cs プロジェクト: lm458180997/Touhou
 //Construct 记录了补间的初始值、最终值和执行补间操作的时间,可传入一个补间函数来确定只随时间如何变化
 public void Construct(double start, double end, double time, TweenFunction tweenF)
 {
     _distance = end - start;
      _original = start;                    //_original是初始值
      _current = start;
      _totalDuration = time;                //总共的维持时间
      _tweenF = tweenF;
 }
コード例 #12
0
ファイル: TweenDynamic.cs プロジェクト: wlgys8/UniTweenAsync
        public static TweenOperation Create(TweenFunction function, float duration)
        {
            var state = new State()
            {
                function = function
            };

            return(TweenAction <State> .Prepare(state, new TweenOptions(duration)));
        }
コード例 #13
0
 public UITweener(Vector2 positionOut, TweenState state, float tween, TweenFunction functionIn, float speedIn, TweenFunction functionOut, float speedOut)
 {
     this.positionOut = positionOut;
     this.state       = state;
     this.tween       = tween;
     this.functionIn  = functionIn;
     this.functionOut = functionOut;
     this.speedIn     = speedIn;
     this.speedOut    = speedOut;
 }
コード例 #14
0
 public static void FadeOutAll(float duration, TweenFunction function = null)
 {
     if (function == null)
     {
         function = TweenFunctions.Linear;
     }
     for (int i = Audio.Instance.handles.Count - 1; i >= 0; --i)
     {
         Sound.FadeOut(Audio.Instance.handles[i], duration, function);
     }
 }
コード例 #15
0
        public void AddTween(float length, TweenFunction tweenFunction)
        {
            tween t = new tween();

            t.length        = length;
            t.startTime     = Time.time;
            t.tweenFunction = tweenFunction;
            t.done          = false;

            tweens.Add(t);
        }
コード例 #16
0
ファイル: AETween.cs プロジェクト: creativethumbs/about-today
    public void MoveTo(float fromValue, float toValue, float time, TweenFunction func, iTween.EaseType ease)
    {
        Vector3 pos = transform.position;
        pos.x = fromValue;
        transform.position = pos;

        _toValue = toValue;

        iTween.MoveTo(gameObject, iTween.Hash("x", toValue,  "time", time, "easeType", ease, "oncomplete", "onTweenComplete", "oncompletetarget", gameObject));

        eventFunction = func;
    }
コード例 #17
0
ファイル: TPTween.cs プロジェクト: stervets/bomber
    public void MoveTo(float fromValue, float toValue, float time, TweenFunction func, iTween.EaseType ease)
    {
        Vector3 pos = transform.position;

        pos.x = fromValue;
        transform.position = pos;

        _toValue = toValue;

        iTween.MoveTo(gameObject, iTween.Hash("x", toValue, "time", time, "easeType", ease, "oncomplete", "onTweenComplete", "oncompletetarget", gameObject));

        eventFunction = func;
    }
コード例 #18
0
        public UITweener(Vector2 positionOut, TweenState state, TweenFunction function, float speed)
            : this(positionOut, state, 0, function, speed, function, speed)
        {
            switch (state)
            {
            case TweenState.TweeningOut:
            case TweenState.In:
                tween = 0;
                break;

            case TweenState.TweeningIn:
            case TweenState.Out:
                tween = 1;
                break;
            }
        }
コード例 #19
0
ファイル: RedTweenClip.cs プロジェクト: crawson7/CodeClass
 public FunctionClip(RedTween.Track track, TweenFunction function, float time, EaseType ease, System.Action end)
 {
     if (function == null)
     {
         return;
     }
     mTrack         = track;
     mTime          = time;
     mFunctionTween = function;
     mEndAction     = end;
     mType          = RedTweenType.Function;
     mFunction      = Easing.EaseFunction(ease);
     if (mFunction != null)
     {
         mInitialized = true;
     }
 }
コード例 #20
0
        public static void FadeOut(Audio.Handle handle, float duration, TweenFunction function = null)
        {
            if (handle == null)
            {
                return;
            }
#if !NOAUDIO
            if (function == null)
            {
                function = TweenFunctions.Linear;
            }
            handle.FadeState    = -1;
            handle.FadeDuration = handle.FadeTimer = duration;
            handle.FadeFunction = function;
            handle.FadeVolume   = handle.Instance.Volume;
#endif
        }
コード例 #21
0
ファイル: Tween.cs プロジェクト: MariusUtheim/GRaff
        public static Tween Animate(TweenFunction f, int duration, Expression <Func <Color> > property, Color finalValue, Action?completeAction = null)
        {
            var s = _setter(property, (double t, Color initialValue) => initialValue.Merge(finalValue, t));

            return(Start(f, duration, s, completeAction));
        }
コード例 #22
0
ファイル: Tween.cs プロジェクト: lm458180997/Touhou
 public Tween(double start, double end, double time, TweenFunction tweenF)
 {
     Construct(start, end, time, tweenF);
 }
コード例 #23
0
ファイル: Tween.cs プロジェクト: KelvinCoding/SevenEngine
 public Tween(float start, float end, float time, TweenFunction tweenF)
 {
     Construct(start, end, time, tweenF);
 }
コード例 #24
0
ファイル: Tweening.cs プロジェクト: Nono02P/TankArmageddon
        private void AffectFunctions()
        {
            switch (TweenType)
            {
            case Tween.Linear:
                _tweenFunction = TweenFunctions.Linear;
                break;

            case Tween.InQuad:
                _tweenFunction = TweenFunctions.InQuad;
                break;

            case Tween.OutQuad:
                _tweenFunction = TweenFunctions.OutQuad;
                break;

            case Tween.InOutQuad:
                _tweenFunction = TweenFunctions.InOutQuad;
                break;

            case Tween.OutInQuad:
                _tweenFunction = TweenFunctions.OutInQuad;
                break;

            case Tween.InCubic:
                _tweenFunction = TweenFunctions.InCubic;
                break;

            case Tween.OutCubic:
                _tweenFunction = TweenFunctions.OutCubic;
                break;

            case Tween.InOutCubic:
                _tweenFunction = TweenFunctions.InOutCubic;
                break;

            case Tween.OutInCubic:
                _tweenFunction = TweenFunctions.OutInCubic;
                break;

            case Tween.InQuart:
                _tweenFunction = TweenFunctions.InQuart;
                break;

            case Tween.OutQuart:
                _tweenFunction = TweenFunctions.OutQuart;
                break;

            case Tween.InOutQuart:
                _tweenFunction = TweenFunctions.InOutQuart;
                break;

            case Tween.OutInQuart:
                _tweenFunction = TweenFunctions.OutInQuart;
                break;

            case Tween.InQuint:
                _tweenFunction = TweenFunctions.InQuint;
                break;

            case Tween.OutQuint:
                _tweenFunction = TweenFunctions.OutQuint;
                break;

            case Tween.InOutQuint:
                _tweenFunction = TweenFunctions.InOutQuint;
                break;

            case Tween.OutInQuint:
                _tweenFunction = TweenFunctions.OutInQuint;
                break;

            case Tween.InSine:
                _tweenFunction = TweenFunctions.InSine;
                break;

            case Tween.OutSine:
                _tweenFunction = TweenFunctions.OutSine;
                break;

            case Tween.InOutSine:
                _tweenFunction = TweenFunctions.InOutSine;
                break;

            case Tween.OutInSine:
                _tweenFunction = TweenFunctions.OutInSine;
                break;

            case Tween.InExpo:
                _tweenFunction = TweenFunctions.InExpo;
                break;

            case Tween.OutExpo:
                _tweenFunction = TweenFunctions.OutExpo;
                break;

            case Tween.InOutExpo:
                _tweenFunction = TweenFunctions.InOutExpo;
                break;

            case Tween.OutInExpo:
                _tweenFunction = TweenFunctions.OutInExpo;
                break;

            case Tween.InCirc:
                _tweenFunction = TweenFunctions.InCirc;
                break;

            case Tween.OutCirc:
                _tweenFunction = TweenFunctions.OutCirc;
                break;

            case Tween.InOutCirc:
                _tweenFunction = TweenFunctions.InOutCirc;
                break;

            case Tween.OutInCirc:
                _tweenFunction = TweenFunctions.OutInCirc;
                break;

            case Tween.InElastic:
                _tweenFunction = TweenFunctions.InElastic;
                break;

            case Tween.OutElastic:
                _tweenFunction = TweenFunctions.OutElastic;
                break;

            case Tween.InOutElastic:
                _tweenFunction = TweenFunctions.InOutElastic;
                break;

            case Tween.OutInElastic:
                _tweenFunction = TweenFunctions.OutInElastic;
                break;

            case Tween.InBack:
                _tweenFunction = TweenFunctions.InBack;
                break;

            case Tween.OutBack:
                _tweenFunction = TweenFunctions.OutBack;
                break;

            case Tween.InOutBack:
                _tweenFunction = TweenFunctions.InOutBack;
                break;

            case Tween.OutInBack:
                _tweenFunction = TweenFunctions.OutInBack;
                break;

            case Tween.InBounce:
                _tweenFunction = TweenFunctions.InBounce;
                break;

            case Tween.OutBounce:
                _tweenFunction = TweenFunctions.OutBounce;
                break;

            case Tween.InOutBounce:
                _tweenFunction = TweenFunctions.InOutBounce;
                break;

            case Tween.OutInBounce:
                _tweenFunction = TweenFunctions.OutInBounce;
                break;

            default:
                throw new ArgumentNullException("Type de Tween non géré dans le constructeur");
            }
        }
コード例 #25
0
ファイル: Tween.cs プロジェクト: MariusUtheim/GRaff
        public static Tween Animate(TweenFunction f, int duration, Expression <Func <Angle> > property, Angle finalValue, Action?completeAction = null)
        {
            var s = _setter(property, (double t, Angle initialValue) => initialValue + t * Angle.Acute(initialValue, finalValue));

            return(Start(f, duration, s, completeAction));
        }
コード例 #26
0
ファイル: Tween.cs プロジェクト: MariusUtheim/GRaff
        public static Tween Start(TweenFunction tweeningFunction, int duration, Action <double> stepAction, Action?completeAction = null)
        {
            var tween = Instance.Create(new Tween(tweeningFunction, duration, stepAction, completeAction));

            return(tween);
        }
コード例 #27
0
ファイル: AETween.cs プロジェクト: creativethumbs/about-today
 public void MoveTo(float fromValue, float toValue, float time, TweenFunction func)
 {
     MoveTo(fromValue, toValue, time, func, iTween.EaseType.linear);
 }
コード例 #28
0
ファイル: Tween.cs プロジェクト: MariusUtheim/GRaff
        public static Tween Animate(TweenFunction f, int duration, Expression <Func <Vector> > property, Vector finalValue, Action?completeAction = null)
        {
            var s = _setter(property, (double t, Vector initialValue) => initialValue * (1 - t) + finalValue * t);

            return(Start(f, duration, s, completeAction));
        }
コード例 #29
0
ファイル: Tween.cs プロジェクト: MariusUtheim/GRaff
 public Tween(TweenFunction tweeningFunction, int duration, Action <double> stepAction)
     : this(tweeningFunction, duration, stepAction, null)
 {
 }
コード例 #30
0
ファイル: TweenDynamic.cs プロジェクト: wlgys8/UniTweenAsync
 public static TweenOperation Dynamic(TweenFunction function, float duration)
 {
     return(TweenDynamic.Create(function, duration));
 }
コード例 #31
0
ファイル: TweenFunction.cs プロジェクト: MariusUtheim/GRaff
 /// <summary>
 /// Performs the tween from the start point to the endpoint, followed by the same tween from the endpoint to the start point.
 /// </summary>
 public static TweenFunction ForwardThenBackwards(this TweenFunction f) => f.CombineWith(f.Backwards());
コード例 #32
0
ファイル: TweenDynamic.cs プロジェクト: wlgys8/UniTweenAsync
 public static TweenOperation Dynamic <T>(TweenFunction <T> function, T parameter, float duration)
 {
     return(TweenDynamic <T> .Create(function, parameter, duration));
 }
コード例 #33
0
 public UITweener(Vector2 positionOut, TweenState state, float tween, TweenFunction function, float speed)
     : this(positionOut, state, tween, function, speed, function, speed)
 {
 }
コード例 #34
0
 public Tween(double start, double end, double time, TweenFunction tweenF)
 {
     Construct(start, end, time, tweenF);
 }
コード例 #35
0
ファイル: DynamicZoom.cs プロジェクト: parhelia512/phantom
 public DynamicZoom(float speed, TweenFunction tweenFunction)
 {
     this.tweenFunction = tweenFunction;
     this.speed         = speed;
 }
コード例 #36
0
ファイル: TweenFunction.cs プロジェクト: MariusUtheim/GRaff
 /// <summary>
 /// Performs the tween from the start point to the endpoint, followed by the tween in reverse.
 /// This does not change the total time span of the function; therefore, animation will appear faster.
 /// </summary>
 public static TweenFunction ForwardThenReverse(this TweenFunction f) => f.CombineWith(f.Reverse());
コード例 #37
0
ファイル: TPTween.cs プロジェクト: stervets/bomber
 public void MoveTo(float fromValue, float toValue, float time, TweenFunction func)
 {
     MoveTo(fromValue, toValue, time, func, iTween.EaseType.linear);
 }