Thread t = new Thread(new ThreadStart(DoPointsShift)); t.Start(); private void DoPointsShift() { int turnsPerMinute = 5; long delay = 60 / turnsPerMinute * 1000 / (360 / 2); long deltaDelay = delay; int beginTime = Environment.TickCount; EasingFunctionBase ease = new CircleEase(); ease.EasingMode = EasingMode.EaseInOut; while (true) { TimeSpan duration = TimeSpan.FromSeconds(1 - 1 * rnd.NextDouble()); foreach (var p in points) { var x = p.OriginX - 50 + rnd.NextDouble() * 100; var y = p.OriginY - 50 + rnd.NextDouble() * 100; PointAnimation anim = new PointAnimation(new Point(x, y), duration); anim.EasingFunction = ease; Dispatcher.BeginInvoke(new Action(() => { p.BeginAnimation(ParallaxPoint.PointCoordProperty, anim); //exception here })); } while (Environment.TickCount - beginTime < delay) { } delay += deltaDelay; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)