Exemplo n.º 1
0
                /// <summary>
                /// フレーム補間:始点フレームから終点フレームにかけて線形的(一次関数的)に変化させます。
                /// </summary>
                public void FrameComplete(int start, int end, EffectFrame.EffectFrameActionEnable param)
                {
                    var frameCount = end - start;

                    for (int now = 1, i = start + 1; i <= end; now++, i++)
                    {
                        if (i < 0 || this.Frames.Length <= i)
                        {
                            //フレームが範囲外の場合は処理しない
                            continue;
                        }

                        if (param.ViewPosition)
                        {
                            this.Frames[i].ViewPosition.X = this.calcComplete(this.Frames[start].ViewPosition.X, this.Frames[end].ViewPosition.X, now, frameCount);
                            this.Frames[i].ViewPosition.Y = this.calcComplete(this.Frames[start].ViewPosition.Y, this.Frames[end].ViewPosition.Y, now, frameCount);
                        }

                        if (param.SectionPosition)
                        {
                            //2次元座標を1次元座標に変換した上で、現在フレームに設定すべき位置を算出する
                            var startSecIndex = this.Frames[start].SectionPosition.X + this.Frames[start].SectionPosition.Y * this.LastSectionPosition.X;
                            var endSecIndex   = this.Frames[end].SectionPosition.X + this.Frames[end].SectionPosition.Y * this.LastSectionPosition.X;
                            var distance      = this.calcComplete(startSecIndex, endSecIndex, now, frameCount);
                            this.Frames[i].SectionPosition = new Point(distance % this.LastSectionPosition.X, (int)Math.Floor((double)distance / this.LastSectionPosition.X));

                            //セクション範囲外にならないように調整する
                            if (this.Frames[i].SectionPosition.Y >= this.LastSectionPosition.Y)
                            {
                                this.Frames[i].SectionPosition.Y = this.LastSectionPosition.Y - 1;
                            }
                            else if (this.Frames[i].SectionPosition.Y < 0)
                            {
                                this.Frames[i].SectionPosition = Point.Empty;
                            }
                        }

                        if (param.Transparent)
                        {
                            this.Frames[i].Transparent = (byte)this.calcComplete(this.Frames[start].Transparent, this.Frames[end].Transparent, now, frameCount);
                        }

                        if (param.Extend)
                        {
                            this.Frames[i].Extend = this.calcComplete(this.Frames[start].Extend, this.Frames[end].Extend, now, frameCount);
                        }

                        if (param.Angle)
                        {
                            this.Frames[i].Angle = this.calcComplete(this.Frames[start].Angle, this.Frames[end].Angle, now, frameCount);
                        }
                    }

                    this.DataChanged?.Invoke(this, new DataChangedEventArgs(false, false, false, false));
                }
Exemplo n.º 2
0
                /// <summary>
                /// フレーム一括:始点フレームの値に統一します。
                /// </summary>
                public void FrameFill(int start, int end, EffectFrame.EffectFrameActionEnable param)
                {
                    for (var i = start + 1; i <= end; i++)
                    {
                        if (i < 0 || this.Frames.Length <= i)
                        {
                            //フレームが範囲外の場合は処理しない
                            continue;
                        }

                        if (param.ViewPosition)
                        {
                            this.Frames[i].ViewPosition = this.Frames[start].ViewPosition;
                        }

                        if (param.SectionPosition)
                        {
                            this.Frames[i].SectionPosition = this.Frames[start].SectionPosition;
                        }

                        if (param.Transparent)
                        {
                            this.Frames[i].Transparent = this.Frames[start].Transparent;
                        }

                        if (param.Extend)
                        {
                            this.Frames[i].Extend = this.Frames[start].Extend;
                        }

                        if (param.Angle)
                        {
                            this.Frames[i].Angle = this.Frames[start].Angle;
                        }

                        if (param.Blend)
                        {
                            this.Frames[i].Blend = this.Frames[start].Blend;
                        }
                    }

                    this.DataChanged?.Invoke(this, new DataChangedEventArgs(false, false, false, false));
                }