Exemple #1
0
        private void Execute(PalCommand command, double oldDeltaTime, double newDeltaTime, double loop)
        {
            bool doesLoop = loop < 10000.0;             // arbitrary number

            if (doesLoop && newDeltaTime > command.End)
            {
                oldDeltaTime = ((oldDeltaTime - loop) % (command.End - loop)) + loop;
                newDeltaTime = ((newDeltaTime - loop) % (command.End - loop)) + loop;
            }

            if (command.Start <= newDeltaTime || (command.End < newDeltaTime && command.End >= oldDeltaTime))
            {
                double t;
                bool   hasFinished = command.End < newDeltaTime;

                if (hasFinished == false)
                {
                    t = (newDeltaTime - command.Start) * 1.0 / (command.End - command.Start);
                    t = EaseUtility.Calculate(command.Ease, t);
                }
                else
                {
                    t = 1.0;
                }

                if (command.InvertedTimer)
                {
                    t = 1.0 - t;
                }

                var parameters = command.Parameters.ToArray();
                entries[command.Command].Execute(this, command, t, parameters);
                if (doesLoop == false && hasFinished == true)
                {
                    var toBurn = entries[command.Command].Burn(parameters);
                    if (toBurn != null)
                    {
                        for (int i = 0; i < toBurn.Length; i++)
                        {
                            backbuffer[i] = palette[i];
                        }
                    }
                }
            }
        }
Exemple #2
0
 public double Get(double x)
 {
     return(EaseUtility.Calculate(Ease, x * Speed + FixStep) * Multiplier + Sum);
 }