void LayoutChildForPosition(CoverflowItem item, int size, double position) { var rotation = -Math.Atan(position * 2) / (Math.PI / 2); Point center = new Point(Width / 2, Height / 2); center.X += size * (1.3 - Math.Abs(rotation * rotation)) * position; item.SetSize(size, size); item.X = center.X - size / 2; item.Y = center.Y - size / 2; item.RotationY = (rotation * 75).Clamp(-72, 72); item.X = item.X.Clamp(-size - 10, Width + 10); item.QueueDraw(); LabelNode label = null; if (position <= 0 && position > -1) { label = leftLabel; } else if (position > 0 && position < 1) { label = rightLabel; } if (label != null) { label.Opacity = Math.Max(0, 1 - Math.Abs(position)); label.Text = item.Name; label.X = center.X - label.Width / 2; label.Y = center.Y + size * 0.6; label.SetSize(label.PreferedWidth, label.PreferedHeight); } }
void LayoutChildForPosition(CoverflowItem item, int size, double position) { var rotation = -Math.Atan (position * 2) / (Math.PI / 2); Point center = new Point (Width / 2, Height / 2); center.X += size * (1.3 - Math.Abs (rotation * rotation)) * position; item.SetSize (size, size); item.X = center.X - size / 2; item.Y = center.Y - size / 2; item.RotationY = (rotation * 75).Clamp (-72, 72); item.X = item.X.Clamp (-size - 10, Width + 10); item.QueueDraw (); LabelNode label = null; if (position <= 0 && position > -1) { label = leftLabel; } else if (position > 0 && position < 1) { label = rightLabel; } if (label != null) { label.Opacity = Math.Max (0, 1 - Math.Abs (position)); label.Text = item.Name; label.X = center.X - label.Width / 2; label.Y = center.Y + size * 0.6; label.SetSize (label.PreferedWidth, label.PreferedHeight); } }