public void Appear() { g_rotation = RANDOM.NextDouble() * 90d - 45d; g_pos_x = RANDOM.NextDouble() * 160d - 80d; g_pos_y = RANDOM.NextDouble() * 240d - 120d; if (_SpriteType == Control.SpriteType.Photo) { g_scale = 1d; double from_x = RANDOM.Next(2) == 0 ? -imageWidthInitial : App.SCREEN_WIDTH + imageWidthInitial; double from_y = RANDOM.Next(2) == 0 ? -imageHeightInitial : App.SCREEN_HEIGHT + imageHeightInitial; RotateAnimation.RotateFromTo(contentPanel, 0d, g_rotation, APPEAR_DURATION); MoveAnimation.MoveFromTo(contentPanel, from_x, from_y, g_pos_x, g_pos_y, APPEAR_DURATION, EASING, fe => { PrepareForManipulation(); }); } else if (_SpriteType == Control.SpriteType.Material || _SpriteType == Control.SpriteType.Text) { g_scale = RANDOM.NextDouble() * 0.3d + 0.8d; MoveAnimation.SetPosition(contentPanel, g_pos_x, g_pos_y); FadeAnimation.Fade(contentPanel, 0d, 1d, APPEAR_DURATION); RotateAnimation.RotateFromTo(contentPanel, 0d, g_rotation, APPEAR_DURATION); ScaleAnimation.ScaleFromTo(contentPanel, 1.5d, 1.5d, g_scale, g_scale, APPEAR_DURATION, fe => { ScaleAnimation.SetScale(fe, 1d, 1d); PrepareForManipulation(); }); } }
public static AnimationSet getInAnimation(Context context) { AnimationSet _in = new AnimationSet(context, null); AlphaAnimation alpha = new AlphaAnimation(0.0f, 1.0f); alpha.Duration = 90; ScaleAnimation scale1 = new ScaleAnimation(0.8f, 1.05f, 0.8f, 1.05f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); scale1.Duration = 135; ScaleAnimation scale2 = new ScaleAnimation(1.05f, 0.95f, 1.05f, 0.95f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); scale2.Duration = 105; scale2.StartOffset = 135; ScaleAnimation scale3 = new ScaleAnimation(0.95f, 1f, 0.95f, 1.0f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); scale3.Duration = 60; scale3.StartOffset = 240; _in.AddAnimation(alpha); _in.AddAnimation(scale1); _in.AddAnimation(scale2); _in.AddAnimation(scale3); return(_in); }
public bool OnScale(ScaleGestureDetector detector) { float scale = 1 - detector.ScaleFactor; float prevScale = mScale; mScale += scale; if (mScale < 0.2f) // Minimum scale condition: { mScale = 0.2f; } if (mScale > 1f) // Maximum scale condition: { mScale = 1f; } System.Diagnostics.Debug.WriteLine($"detector.FocusX: {detector.FocusX}, detector.FocusY: {detector.FocusY}"); System.Diagnostics.Debug.WriteLine($"mScale: {mScale}"); ScaleAnimation scaleAnimation = new ScaleAnimation(1f / prevScale, 1f / mScale, 1f / prevScale, 1f / mScale, detector.FocusX + 10, detector.FocusY); scaleAnimation.Duration = 0; scaleAnimation.FillAfter = true; StartAnimation(scaleAnimation); return(true); }
// ------------------------------------------------------------------------ public override bool grabbed(GameObject by) { isGrabbed = true; anim = gameObject.GetComponent <ScaleAnimation>(); anim.run(); return(true); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource //SetContentView (Resource.Layout.Main); ImageView img = new ImageView(this); //set heart image to imageview img.SetImageResource(Resource.Drawable.Heart); //Set the imageview as a content view SetContentView(img); //Create an action Action act = new Action(() => { //Create an instance of our custom interpolator customInterpolator i = new customInterpolator(); //Create an Scale Animation(fromX,toX,fromY,toY,pivotX,pivotY) ScaleAnimation anim = new ScaleAnimation(1, 1.2f, 1, 1.2f, img.Width / 2, img.Height / 2); //Set repeat count to infinite anim.RepeatCount = Animation.Infinite; //Set the animation duration anim.Duration = 750; //Set the animation custom interpolator anim.Interpolator = i; //Attach our Custom Scale Animation to the imageview img.StartAnimation(anim); }); //Post the action to the imageview img.Post(act); }
public bool OnScale(ScaleGestureDetector detector) { var scale = 1 - detector.ScaleFactor; var prevScale = _mScale; _mScale += scale; if (_mScale < 0.8f) // Minimum scale condition: { _mScale = 0.8f; } if (_mScale > 2f) // Maximum scale condition: { _mScale = 2f; } var scaleAnimation = new ScaleAnimation(1f / prevScale, 1f / _mScale, 1f / prevScale, 1f / _mScale, detector.FocusX, detector.FocusY) { Duration = 0, FillAfter = true }; StartAnimation(scaleAnimation); return(true); }
public override void initView() { btn_start = FindViewById <Button> (Resource.Id.btn_start); tv_maintitle = FindViewById <TextView> (Resource.Id.tv_maintitle); ll_root = FindViewById <LinearLayout> (Resource.Id.ll_root); //ll_root animation AnimationSet set = new AnimationSet(true); //rotate animation RotateAnimation rotate = new RotateAnimation(0, 360, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); //scale animation ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f); set.AddAnimation(rotate); set.AddAnimation(scaleAnimation); set.Duration = 2000; set.FillAfter = true; ll_root.StartAnimation(set); set.AnimationEnd += delegate(object sender, Animation.AnimationEndEventArgs e) { handler.PostDelayed(delegate() { NineOldAndroids.View.ViewPropertyAnimator.Animate(tv_maintitle).SetDuration(1200).Alpha(1.0f).Start(); }, 2000); handler.PostDelayed(delegate() { btn_start.Visibility = ViewStates.Visible; NineOldAndroids.View.ViewPropertyAnimator.Animate(btn_start).SetDuration(1500).TranslationY(-150).Start(); }, 1200); }; }
public void Show(float translationX, float translationY) { // Set FAB's translation SetTranslation(translationX, translationY); // Only use scale animation if FAB is hidden if (Visibility != ViewStates.Visible) { // Pivots indicate where the animation begins from float pivotX = PivotX + translationX; float pivotY = PivotY + translationY; ScaleAnimation anim; // If pivots are 0, that means the FAB hasn't been drawn yet so just use the // center of the FAB if (pivotX == 0 || pivotY == 0) { anim = new ScaleAnimation(0, 1, 0, 1, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); } else { anim = new ScaleAnimation(0, 1, 0, 1, pivotX, pivotY); } // Animate FAB expanding anim.Duration = FAB_ANIM_DURATION; anim.Interpolator = GetInterpolator(); StartAnimation(anim); } Visibility = ViewStates.Visible; }
public MPopUpPage(AboutItem aboutItem) { BackgroundColor = Color.FromHex("#80000000"); Animation = new ScaleAnimation(); Label title = new Label { Text = aboutItem.title, FontSize = 25, HorizontalTextAlignment = TextAlignment.Center }; Image mImage = new Image { Source = aboutItem.image, Aspect = Aspect.AspectFit, HeightRequest = 100, WidthRequest = 400, HorizontalOptions = LayoutOptions.Start }; Label mLabel = new Label { Text = aboutItem.content, FontSize = 15 }; StackLayout aboutStacklayout = new StackLayout { BackgroundColor = Color.White }; aboutStacklayout.Children.Add(title); aboutStacklayout.Children.Add(mImage); aboutStacklayout.Children.Add(mLabel); ScrollView scrollView = new ScrollView { Orientation = ScrollOrientation.Vertical, HorizontalOptions = LayoutOptions.Center }; scrollView.Content = aboutStacklayout; Content = scrollView; }
private void Awake() { transform = GetComponent <Transform>(); collider = GetComponent <Collider2D>(); scaleAnimation = GetComponent <ScaleAnimation>(); scaleAnimation.Scale = transform.localScale; }
// ------------------------------------------------------------------------ public void destroy() { ScaleAnimation anim = GetComponent <ScaleAnimation>(); if (anim.scale() > 0) { anim.run(this); } }
// Start is called before the first frame update void Start() { key = gameObject.name; buttonText = GetComponentInChildren <Text>(); scaleAnimation = GetComponent <ScaleAnimation>(); audioSource = GetComponent <AudioSource>(); buttonText.text = key; buttonText.fontSize = fontSize; }
public static void AnimStart(ImageView Logo) { ScaleAnimation unscal_grow = new ScaleAnimation(1.2f, 1.0f, 1.2f, 1.0f, Android.Views.Animations.Dimension.RelativeToSelf, (float)0.5, Android.Views.Animations.Dimension.RelativeToSelf, (float)0.5); unscal_grow.Duration = 500; unscal_grow.FillAfter = true; unscal_grow.RepeatCount = Android.Views.Animations.Animation.Infinite; unscal_grow.RepeatMode = RepeatMode.Reverse; Logo.StartAnimation(unscal_grow); }
/// <summary> /// Resets the camera to the default cast position. /// </summary> private void ResetForCast() { if (_camera.Scale != Vector2.One) { SetCameraFocus(SwingFocus); // update the scale animation separately to keep it from // being overwritten by the lure-tracking animation _scaleAnimation = new ScaleAnimation(_camera, Vector2.One, CatchScaleTime, Interpolate); } }
private void AnimateCallout() { // Create a scale animation ScaleAnimation animation = new ScaleAnimation(0.5f, 1.0f, 0.5f, 1.0f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 1.0f); animation.Duration = SCALE_DURATION_MILLS; this.StartAnimation(animation); }
private async void Button_Clicked(object sender, EventArgs e) { var popupProperties = new TestPop(); var scaleAnimation = new ScaleAnimation { PositionIn = MoveAnimationOptions.Right, PositionOut = MoveAnimationOptions.Left }; await PopupNavigation.PushAsync(popupProperties); }
/// <summary> /// Explodes the specified view. /// </summary> /// <param name="view">The view.</param> /// <param name="duration">The duration of the explosion.</param> /// <param name="onHidden">The callback that is invoked when the view is no longer visible.</param> public void Explode(View view, long duration, Action onHidden) { const float vibrateAmount = 0.05f; var preDuration = (long)(duration * 0.25f); var explosionDuration = (long)(duration * 0.75f); var startDelay = (long)(duration * 0.15f); // get the bounds var r = new Rect(); view.GetGlobalVisibleRect(r); var location = new int[2]; GetLocationOnScreen(location); r.Offset(-location[0], -location[1]); r.Inset(-ExpansionLimit, -ExpansionLimit); var set = new AnimationSet(true); // vibrate var vibrate = new VibrateAnimation(view.Width * vibrateAmount, view.Height * vibrateAmount); vibrate.Duration = preDuration; set.AddAnimation(vibrate); // implode var alpha = new AlphaAnimation(1.0f, 0.0f); alpha.Duration = preDuration; alpha.StartOffset = startDelay; set.AddAnimation(alpha); var scale = new ScaleAnimation( 1.0f, 0.0f, 1.0f, 0.0f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); scale.Duration = preDuration; scale.StartOffset = startDelay; set.AddAnimation(scale); // apply on complete set.AnimationEnd += delegate { view.Visibility = ViewStates.Invisible; if (onHidden != null) { onHidden(); } }; view.StartAnimation(set); // explode Explode(Utils.CreateBitmapFromView(view), r, startDelay, explosionDuration); }
private async void whatis_button(object sender, EventArgs e) { var pr = new WhatIsPage(); var scaleAnimation = new ScaleAnimation { PositionIn = MoveAnimationOptions.Right, PositionOut = MoveAnimationOptions.Left }; pr.Animation = scaleAnimation; await PopupNavigation.PushAsync(pr); }
private async Task totalCommandayncAsync() { var pr = new PopUp(); var scaleAnimation = new ScaleAnimation { PositionIn = MoveAnimationOptions.Right, PositionOut = MoveAnimationOptions.Left }; pr.Animation = scaleAnimation; await PopupNavigation.PushAsync(pr); }
private async void Button_OnClicked(object sender, EventArgs e) { var pr = new PopUp(); var scaleAnimation = new ScaleAnimation { PositionIn = MoveAnimationOptions.Right, PositionOut = MoveAnimationOptions.Left }; pr.Animation = scaleAnimation; await PopupNavigation.PushAsync(pr); }
public static AnimationSet getOutAnimation(Context context) { AnimationSet _out = new AnimationSet(context, null); AlphaAnimation alpha = new AlphaAnimation(1.0f, 0.0f); alpha.Duration = 150; ScaleAnimation scale = new ScaleAnimation(1.0f, 0.6f, 1.0f, 0.6f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); scale.Duration = 150; _out.AddAnimation(alpha); _out.AddAnimation(scale); return(_out); }
private async void Button_Clicked_1(object sender, EventArgs e) { if (SelectedOrder != null) { var popupProperties = new PopUpOrderDetail(SelectedOrder.Items, SelectedOrder); var scaleAnimation = new ScaleAnimation { PositionIn = MoveAnimationOptions.Right, PositionOut = MoveAnimationOptions.Left }; await PopupNavigation.Instance.PushAsync(popupProperties); } }
private void AnimateShow(View view) { var anim = new ScaleAnimation(0, 1, 0, 1, .5f, .5f); anim.FillBefore = true; anim.FillAfter = true; anim.FillEnabled = true; anim.Duration = 300; anim.StartOffset = 500; anim.Interpolator = new OvershootInterpolator(); view.StartAnimation(anim); }
public virtual async Task <BasePopUp> Show() { ScaleAnimation scaleAnimation = new ScaleAnimation { PositionIn = MoveAnimationOptions.Right, PositionOut = MoveAnimationOptions.Left }; this.Animation = scaleAnimation; await PopupNavigation.Instance.PushAsync(this, true); return(this); }
private async void MyListView_ItemTapped(Object sender, ItemTappedEventArgs e) { var choose = e.Item as Product; var pr = new PopupCompra(); var scaleAnimation = new ScaleAnimation { PositionIn = MoveAnimationOptions.Right, PositionOut = MoveAnimationOptions.Left }; pr.Animation = scaleAnimation; await PopupNavigation.PushAsync(pr); }
private void OnHelpButtonClicked(object sender, EventArgs args) { //start animation when button is pressed ImageButton ib = sender as ImageButton; Animation buttonPressAnim = new ScaleAnimation(1, 0.8f, 1, 0.8f, 50, 50); buttonPressAnim.Duration = 100; ib.StartAnimation(buttonPressAnim); //do something else when animation finishes ib.Animation.AnimationEnd += delegate { StartHelpActivity(); /*flipper.DisplayedChild = 7; goto tasks-screen*/ }; }
public Button(string text, Font font, uint fontSize, Vector2f position, float scale = 1f) { _text = new Text(text, font, fontSize); _text.Origin = new Vector2f( _text.GetLocalBounds().Left + _text.GetLocalBounds().Width / 2, _text.GetLocalBounds().Top + _text.GetLocalBounds().Height); _text.Position = position; _text.Scale = new Vector2f(scale, scale); var increaseAnimation = new ScaleAnimation<Button>(scale, 1f); var decreaseAnimation = new ScaleAnimation<Button>(1f, scale); _animator.AddAnimation("increase", increaseAnimation, TimeSpan.FromMilliseconds(200)); _animator.AddAnimation("decrease", decreaseAnimation, TimeSpan.FromMilliseconds(200)); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ImageView image = new ImageView(this); image.SetImageResource(Resource.Drawable.icon); SetContentView(image); var animation = new ScaleAnimation(0.1f, 0.5f, 0.1f, 0.5f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); animation.SetAnimationListener(this); animation.FillAfter = true; animation.Duration = 2000; image.StartAnimation(animation); }
private static void HandleTransformFontSizeTag(AssTagContext context, DateTime startTime, DateTime endTime, int accel, string arg) { if (!TryParseFloat(arg, out float size)) { return; } AssSection section = context.Section; ScaleAnimation prevAnim = section.Animations.OfType <ScaleAnimation>().LastOrDefault(); float startScale = prevAnim?.EndScale ?? context.Section.Scale; float endScale = size / context.Document.DefaultFontSize; context.Section.Animations.Add(new ScaleAnimation(startTime, startScale, endTime, endScale)); }
public static void playClickAnim(View targetView) { float SCALE_FACTOR = 0.3f; AnimationSet animSet = new AnimationSet(true); TranslateAnimation translateAnim = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, -SCALE_FACTOR / 2, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, -SCALE_FACTOR / 2); animSet.addAnimation(translateAnim); ScaleAnimation anim = new ScaleAnimation(1f, 1f + SCALE_FACTOR, 1f, 1f + SCALE_FACTOR); animSet.addAnimation(anim); animSet.Interpolator = new AccelerateDecelerateInterpolator(); animSet.Duration = 150; targetView.startAnimation(animSet); }
public void OnLayoutClicked(View view) { if (rectBackground != null) { ScaleAnimation scaleAnimation = new ScaleAnimation(1, 0.7f, 1, 0.7f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); scaleAnimation.Duration = 300; scaleAnimation.RepeatCount = 1; scaleAnimation.RepeatMode = RepeatMode.Reverse; rectBackground.StartAnimation(scaleAnimation); } if (roundBackground != null) { roundBackground.Animate().RotationBy(360).SetDuration(300).Start(); } }
// Use this for initialization void Start() { m_anim = GetComponent<ScaleAnimation>(); Invoke("SecretaryHint", hintDelay); }