void DelayAction(Action action, int duration) { HandyAnimator delay = HandyAnimator.OfNothing(duration); delay.After += action; delay.core.Start(); }
public void Start() { anim = HandyAnimator.OfFloat((float)Math.PI * 2, 0, LapDuration); anim.core.SetInterpolator(new LinearInterpolator()); anim.Update += (value) => CurAngle = (float)value; anim.core.RepeatCount = -1; anim.core.Start(); }
void AnimateSwitch(float fromX, float toX, Action action) { switchAnim = HandyAnimator.OfFloat(fromX, toX, SwitchDuration); switchAnim.core.SetInterpolator(new DecelerateInterpolator(SwitchEasingFactor)); switchAnim.Update += (value) => pivot.X = (float)value; switchAnim.After += action; switchAnim.core.Start(); }
public void AnimateAppearance() { HandyAnimator anim = HandyAnimator.OfFloat(0, 1, AppearanceDuration); anim.Update += (value) => VisiblePart = (float)(value); anim.core.Start(); SoundMaster.PlaySound(SoundMaster.SegmentBornSound); }
void AnimateDivingTo(int divingTimeDest) { diveAnim?.core.Cancel(); diveAnim = HandyAnimator.OfFloat(currentDiveTime, divingTimeDest, (int)Math.Abs(currentDiveTime - divingTimeDest)); diveAnim.Update += (value) => CurrentDiveTime = (float)value; diveAnim.core.Start(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); SoundMaster.LoadSounds(); InitScenes(); HandyAnimator delayAnim = HandyAnimator.OfNothing(500); delayAnim.After += () => LogoScene.Instance.Show(Side.Right); delayAnim.core.Start(); }
public void AnimateAppearance() { HandyAnimator apAnim = HandyAnimator.OfFloat(0, 1, BirthDuration); apAnim.core.SetInterpolator(new OvershootInterpolator(2)); apAnim.core.StartDelay = (int)(random.NextDouble() * MaxBirthDelay); apAnim.Update += (value) => BirthScaleFactor = (float)value; apAnim.core.AnimationStart += (sender, e) => SoundMaster.PlaySound(SoundMaster.PointBornSound); apAnim.core.Start(); }
protected override void OnDestroy() { base.OnDestroy(); TaskRegistrator.CancelAllTasks(); TouchHandler.RemoveAllListeners(); HandyAnimator.OnActivityDestroy(); SoundMaster.StopAllSounds(); SoundMaster.UnloadSounds(); RemoveScenes(); GameView.Instance = null; GC.Collect(); }
void KillAnims() { foreach (HandyAnimator anim in new HandyAnimator[] { exitAnim, sureAnim, replayAnim }) { if (anim != null && anim.core.IsRunning) { anim.core.Cancel(); } } exitAnim = sureAnim = replayAnim = null; }
static public void ChangeBackgroundColor(bool toBlack) { float coefDest = (toBlack) ? 0 : 1; var prefs = Application.Context.GetSharedPreferences("AppPrefs", FileCreationMode.Private); var editor = prefs.Edit(); editor.PutFloat("background", coefDest); editor.Commit(); bgAnim?.core.Cancel(); bgAnim = HandyAnimator.OfFloat(currentBgCoef, coefDest, (int)(Math.Abs(currentBgCoef - coefDest) * BgAnimDuration)); bgAnim.core.SetInterpolator(new DecelerateInterpolator(1.6f)); bgAnim.Update += (value) => CurrentBgCoef = (float)value; bgAnim.core.Start(); }
public void Stop() { anim.core.Cancel(); anim = null; }