示例#1
0
        public override HashSet <AnimatedPoint> RenderFrame(int currentFrame)
        {
            if (animatedPoints.Count == 0)
            {
                foreach (var point in InRange)
                {
                    var animPoint = new AnimatedPoint(point);

                    DoPointDisplacement(animPoint, currentFrame);

                    animatedPoints.Add(animPoint);

                    //AddConnectedPoints(point, InRange, animatedPoints, true);
                }
            }
            else
            {
                foreach (var animPoint in animatedPoints)
                {
                    DoPointDisplacement(animPoint, currentFrame);
                }
            }

            return(animatedPoints);
        }
示例#2
0
        public override HashSet <AnimatedPoint> RenderFrame(int currentFrame)
        {
            var animatedPoints = new HashSet <AnimatedPoint>();

            //accumulate all points in the current column represented by frame index
            List <SkiaSharp.SKPoint> framePoints = new List <SkiaSharp.SKPoint>();

            for (int i = 0; i < NumFrames; i++)
            {
                var p = new SkiaSharp.SKPointI(currentFrame, i);
                if (SeperatedPoints.ContainsKey(p))
                {
                    framePoints.AddRange(SeperatedPoints[p]);
                }
            }

            foreach (var point in framePoints)
            {
                var distCanMove = shortestDistanceFromPoints(point);
                var xComponent  = Geometry.getXComponent(_direction, distCanMove);
                var yComponent  = Geometry.getYComponent(_direction, distCanMove);
                var p           = new AnimatedPoint(point, (float)xComponent, (float)yComponent);
                animatedPoints.Add(p);
            }
            return(animatedPoints);
        }
示例#3
0
        protected override void DoPointDisplacement(AnimatedPoint point, int currentFrame)
        {
            var direction = (int)Geometry.GetPolarCoordinates(TouchLocation, point.Point);

            var distCanMove = 20;

            point.XDisplacement = Random.Rand.Next(-_displacementRange, _displacementRange);
            point.YDisplacement = Random.Rand.Next(-_displacementRange, _displacementRange);

            //limiting the total dist this point can travel
            var maxXComponent = Geometry.getXComponent(direction, distCanMove);
            var maxYComponent = Geometry.getYComponent(direction, distCanMove);

            point.SetMaxDisplacement(maxXComponent, maxYComponent);
        }
示例#4
0
        protected override void DoPointDisplacement(AnimatedPoint point, int currentFrame)
        {
            var direction = (int)Geometry.GetPolarCoordinates(TouchLocation, point.Point);

            var distCanMove      = shortestDistanceFromPoints(point.Point);
            var frameDistCanMove = frameLocation(currentFrame, NumFrames, distCanMove);

            point.XDisplacement = Geometry.getXComponent(direction, frameDistCanMove);
            point.YDisplacement = Geometry.getYComponent(direction, frameDistCanMove);

            //limiting the total dist this point can travel
            //(its possible for stacked animations to animate the same point, want to limit the total distance the point can travel)
            var maxXComponent = Geometry.getXComponent(direction, distCanMove);
            var maxYComponent = Geometry.getYComponent(direction, distCanMove);

            point.SetMaxDisplacement(maxXComponent, maxYComponent);
        }
示例#5
0
 protected abstract void DoPointDisplacement(AnimatedPoint point, int currentFrame);
示例#6
0
 protected bool Equals(AnimatedPoint other)
 {
     return(Point.Equals(other.Point) && XDisplacement.Equals(other.XDisplacement) && YDisplacement.Equals(other.YDisplacement));
 }