public void CreateClickedCloneAnimation(ClutterFlowBaseActor actor, uint delay) { if (actor.Parent != null) { Clone clone = new Clone(actor); MoveAndRotateActorCentrally(clone, 0); double scaleX, scaleY; actor.GetScale(out scaleX, out scaleY); clone.SetScale(scaleX, scaleY); ((Container)actor.Parent).Add(clone); clone.Hide(); clone.Opacity = 255; clone.Depth = ZNear + 1; Timeline timeline = new Timeline(CoverManager.MaxAnimationSpan * 4); timeline.Delay = delay; timeline.AddMarkerAtTime("start", 1); timeline.MarkerReached += delegate { clone.ShowAll(); }; Animation anmn = clone.AnimateWithTimelinev((ulong)AnimationMode.EaseInExpo.value__, timeline, new string[] { "opacity" }, new GLib.Value((byte)50)); clone.AnimateWithTimelinev((ulong)AnimationMode.EaseInExpo.value__, timeline, new string[] { "scale-x" }, new GLib.Value(scaleX * 2)); clone.AnimateWithTimelinev((ulong)AnimationMode.EaseInExpo.value__, timeline, new string[] { "scale-y" }, new GLib.Value(scaleY * 2)); clone.AnimateWithTimelinev((ulong)AnimationMode.EaseInExpo.value__, timeline, new string[] { "fixed::anchor-x" }, new GLib.Value(clone.Width / 2)); clone.AnimateWithTimelinev((ulong)AnimationMode.EaseInExpo.value__, timeline, new string[] { "fixed::anchor-y" }, new GLib.Value(clone.Height / 4)); anmn.Completed += HandleClickedCloneCompleted; } }
private void HandleNewCurrentCover(ClutterFlowBaseActor Actor, EventArgs args) { if (CoverManager.CurrentCover == this) { CoverManager.NewCurrentCover -= HandleNewCurrentCover; CoverManager.Behaviour.CreateClickedCloneAnimation(this, CoverManager.MaxAnimationSpan); } }
protected void InvokeNewCurrentCover(ClutterFlowBaseActor cover) { var handler = NewCurrentCover; if (handler != null) { handler(cover, EventArgs.Empty); } }
internal void InvokeActorActivated(ClutterFlowBaseActor cover) { var handler = ActorActivated; if (handler != null) { handler(cover, EventArgs.Empty); } }
public override void Dispose() { if (reload_timeout > 0) { GLib.Source.Remove(reload_timeout); } behaviour.Dispose(); timeline.Dispose(); covers.Clear(); covers = null; current_cover = null; base.Dispose(); }
private IEnumerable <ClutterFlowBaseActor> SafeGetRange(List <ClutterFlowBaseActor> list, int index, int count) { for (int i = index; i < index + count; i++) { ClutterFlowBaseActor cover = null; if (i >= 0 && i < list.Count) { cover = list[i]; } if (cover == null) { continue; } yield return(cover); } yield break; }
protected void UpdateActorWithAlpha(ClutterFlowBaseActor actor, double alpha) { float ratio = Math.Min(0.75f * (float)coverManager.Timeline.Delta / (float)coverManager.VisibleCovers, 1.25f); OffsetRotationAngle = (float)((rotationAngle / 5) * ratio); OffsetCenterX = -(float)((CenterMargin / 2) * ratio); OffsetZNear = (int)(-(ZNear - ZFar) * 1.5 * ratio); if (coverManager.Timeline.Direction != TimelineDirection.Forward) { OffsetRotationAngle = -OffsetRotationAngle; OffsetCenterX = -OffsetCenterX; } actor.SetScale(coverWidth / actor.Width, coverWidth / actor.Width); if (alpha != 0 || alpha != 1) { //if (!visible_actors.Contains (actor)) visible_actors.Add (actor); actor.Show(); if (alpha < AlphaStep) { MoveAndFadeOutActor(actor, (float)(alpha / AlphaStep), true); } else if (alpha >= AlphaStep && alpha <= 0.5 - AlphaStep) { MoveActorSideways(actor, (float)((alpha - AlphaStep) / (0.5f - 2 * AlphaStep)), true); } else if (alpha > 0.5f - AlphaStep && alpha < 0.5f + AlphaStep) { MoveAndRotateActorCentrally(actor, (float)((alpha - 0.5f) / AlphaStep)); } else if (alpha >= 0.5f + AlphaStep && alpha <= 1 - AlphaStep) { MoveActorSideways(actor, (float)((1 - AlphaStep - alpha) / (0.5f - 2 * AlphaStep)), false); } else if (alpha > 1 - AlphaStep) { MoveAndFadeOutActor(actor, (float)((1 - alpha) / AlphaStep), false); } } else { //if (visible_actors.Contains (actor)) visible_actors.Remove (actor); actor.Hide(); } }
public void UpdateLetterLookup(ClutterFlowBaseActor actor) { string label = actor.SortLabel.ToUpper().Normalize(System.Text.NormalizationForm.FormKD); char letter = label.Length > 0 ? char.Parse(label.Substring(0, 1)) : '?'; AlphabetChars key; if (char.IsLetter(letter)) { key = (AlphabetChars)letter; } else { key = AlphabetChars.unknown; } if (letter_lookup.ContainsKey(key) && letter_lookup[key] == -1) { letter_lookup[key] = actor.Index; } }
protected double AlphaFunc(ClutterFlowBaseActor actor, double progress) { if (actor.Index < 0) { actor.Data["last_alpha"] = (double)0; } else { double previous_alpha = (CoverManager.HalfVisCovers - (CoverManager.TotalCovers - 1) * progress + actor.Index) / (CoverManager.VisibleCovers - 1); if (previous_alpha < 0) { previous_alpha = 0; } if (previous_alpha > 1) { previous_alpha = 1; } actor.Data["last_alpha"] = previous_alpha; } return((double)actor.Data["last_alpha"]); }
public void CreateClickedCloneAnimation(ClutterFlowBaseActor actor) { CreateClickedCloneAnimation(actor, 0); }
protected double AlphaFunc(ClutterFlowBaseActor actor) { return(AlphaFunc(actor, CoverManager.Timeline.Progress)); }
protected void UpdateActor(ClutterFlowBaseActor actor, double progress) { UpdateActorWithAlpha(actor, AlphaFunc(actor)); }
protected void UpdateActor(ClutterFlowBaseActor actor) { UpdateActor(actor, Progress); }
protected void HideActor(ClutterFlowBaseActor actor) { actor.Hide(); }