private static bool updateChildData(AnimatingPanelItemData data, double dampening, double attractionFactor, double variation) { if (data == null) { return(false); } else { Debug.Assert(dampening > 0 && dampening < 1); Debug.Assert(attractionFactor > 0 && !double.IsInfinity(attractionFactor)); attractionFactor *= 1 + (variation * data.RandomSeed - .5); Point newLocation; Vector newVelocity; bool anythingChanged = GeoHelper.Animate(data.Current, data.LocationVelocity, data.Target, attractionFactor, dampening, c_terminalVelocity, c_diff, c_diff, out newLocation, out newVelocity); data.Current = newLocation; data.LocationVelocity = newVelocity; var transformVector = data.Current - data.Target; data.Transform.SetToVector(transformVector); return(anythingChanged); } }
protected void ArrangeChild(UIElement child, Rect bounds) { m_listener.StartListening(); AnimatingPanelItemData data = (AnimatingPanelItemData)child.GetValue(DataProperty); if (data == null) { data = new AnimatingPanelItemData(); child.SetValue(DataProperty, data); Debug.Assert(child.RenderTransform == Transform.Identity); child.RenderTransform = data.Transform; data.Current = ProcessNewChild(child, bounds); } Debug.Assert(child.RenderTransform == data.Transform); //set the location attached DP data.Target = bounds.Location; child.Arrange(bounds); }
private static bool UpdateChildData(AnimatingPanelItemData data, double dampening, double attractionFactor, double variation) { if (data == null) { return false; } else { Debug.Assert(dampening > 0 && dampening < 1); Debug.Assert(attractionFactor > 0 && !double.IsInfinity(attractionFactor)); attractionFactor *= 1 + (variation * data.RandomSeed - .5); Point newLocation; Vector newVelocity; bool anythingChanged = GeoHelper.Animate(data.Current, data.LocationVelocity, data.Target, attractionFactor, dampening, c_terminalVelocity, c_diff, c_diff, out newLocation, out newVelocity); data.Current = newLocation; data.LocationVelocity = newVelocity; Vector transformVector = data.Current - data.Target; data.Transform.SetToVector(transformVector); return anythingChanged; } }
protected void ArrangeChild(UIElement child, Rect bounds) { m_listener.StartListening(); var data = (AnimatingPanelItemData)child.GetValue(DataProperty); if (data == null) { data = new AnimatingPanelItemData(); child.SetValue(DataProperty, data); Debug.Assert(Equals(child.RenderTransform, Transform.Identity)); child.RenderTransform = data.Transform; data.Current = ProcessNewChild(child, bounds); } Debug.Assert(Equals(child.RenderTransform, data.Transform)); //set the location attached DP data.Target = bounds.Location; child.Arrange(bounds); }