Postingan

Menampilkan postingan dengan label Animation Code

Animation Blink with Alpha

ObjectAnimator anim = ObjectAnimator.ofFloat(text, "Alpha", 0, 1); anim.setRepeatMode(ObjectAnimator.REVERSE); anim.setRepeatCount(ObjectAnimator.INFINITE); anim.setDuration(700); anim.start();

Animation bounce

ObjectAnimator anim = ObjectAnimator.ofFloat(textView, "ScaleY", 0, 1); anim.setInterpolator(new BounceInterpolator()); anim.setDuration(1000); anim.start();

Animation Colors

ObjectAnimator anim = ObjectAnimator.ofArgb(text, "TextColor", Color.MAGENTA, Color.BLUE, Color.CYAN, Color.GREEN); anim.setDuration(5000); ObjectAnimator animBgr = ObjectAnimator.ofArgb(text, "BackgroundColor", Color.CYAN, Color.GREEN, Color.MAGENTA, Color.BLUE); animBgr.setDuration(5000); AnimatorSet animSet = new AnimatorSet(); animSet.play(anim).with(animBgr); animSet.start();

Animation Fade

//IN final AlphaAnimation fadeIn = new AlphaAnimation(1.0f,0.0f); final AlphaAnimation fadeOut = new AlphaAnimation(0.0f,1.0f); text.startAnimation(fadeIn); text.startAnimation(fadeOut); fadeIn.setDuration(1200); fadeIn.setFillAfter(true); fadeOut.setDuration(1200); fadeOut.setFillAfter(true); fadeOut.setStartOffset(10+fadeIn.getStartOffset()); //OUT final AlphaAnimation fadeIn = new AlphaAnimation(0.0f,1.0f); final AlphaAnimation fadeOut = new AlphaAnimation(1.0f,0.0f); text.startAnimation(fadeIn); text.startAnimation(fadeOut); fadeIn.setDuration(1200); fadeIn.setFillAfter(true); fadeOut.setDuration(1200); fadeOut.setFillAfter(true); fadeOut.setStartOffset(10+fadeIn.getStartOffset());

Animation Fade With Alpha

//IN ObjectAnimator anim = ObjectAnimator.ofFloat(textView, "Alpha", 0, 1); anim.setDuration(5000); anim.start(); //Out ObjectAnimator anim = ObjectAnimator.ofFloat(textView, "Alpha", 1, 0); anim.setDuration(5000); anim.start();

Animation Move

TranslateAnimation translateAnimation = new TranslateAnimation (Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,.85f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0.65f); translateAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); translateAnimation.setDuration(1200); text.startAnimation(translateAnimation);

Animation Rotate

/Anti ClockWise RotateAnimation rotateAnimation = new RotateAnimation(360, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotateAnimation.setInterpolator(new AccelerateInterpolator()); rotateAnimation.setDuration(3000); text.startAnimation(rotateAnimation); //Default RotateAnimation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotateAnimation.setInterpolator(new LinearInterpolator()); rotateAnimation.setDuration(3000); text.startAnimation(rotateAnimation);

Animation Slide Down/Up

//Down ObjectAnimator anim = ObjectAnimator.ofFloat(text, "ScaleY", 0, 1); anim.setDuration(4000); anim.start(); //Up ObjectAnimator anim = ObjectAnimator.ofFloat(text, "ScaleY", 1, 0); anim.setDuration(2000); anim.start();

Animation Slide In/Out

//In ObjectAnimator anim = ObjectAnimator.ofFloat(text, "ScaleX", 1, 0); anim.setDuration(2000); anim.start(); //Out ObjectAnimator anim = ObjectAnimator.ofFloat(text, "ScaleX", 0, 1); anim.setDuration(2000); anim.start();

Animation Text Blink

Animation anim =new AlphaAnimation(0.0f,1.0f); anim.setDuration(50); anim.setStartOffset(20); anim.setRepeatMode(Animation.REVERSE); anim.setRepeatCount(Animation.INFINITE); text.startAnimation(anim);

Animation TranslateXY

//Animation From XML tranlate Animation animation = new TranslateAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta); animation.setDuration(1500); animation.setFillAfter(true); view.startAnimation(animation);

Animation Transtition Animation

/*this will go in button click, activity start, or whatever*/ android.transition.TransitionManager.beginDelayedTransition(linear1,makeFadeTransition()); toggleVisibility(imageview1,imageview2,imageview3,imageview4); android.transition.TransitionManager.beginDelayedTransition(linear1,makeSlideTransition()); toggleVisibility(imageview1,imageview2,imageview3,imageview4); android.transition.TransitionManager.beginDelayedTransition(linear1,makeExplodeTransition()); toggleVisibility(imageview1,imageview2,imageview3,imageview4); /*This stays at the bottom of all code in onCreate*/ } private android.transition.Fade makeFadeTransition(){ android.transition.Fade fade = new android.transition.Fade(); fade.setDuration(2000); fade.setInterpolator(new AnticipateInterpolator()); return fade; } private android.transition.Slide makeSlideTransition(){ android.transition.Slide slide = new android.transition.Slide(); slide.setSlideEdge(Gravity.TOP); slide.setInterpolator(new BounceInterpolator()); slide.s...

Animation ZoomIn/ZoomOut

//IN ScaleAnimation scaleAnimation = new ScaleAnimation(1f,4f,1f,4f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scaleAnimation.setInterpolator(new LinearInterpolator()); scaleAnimation.setDuration(1800); text.startAnimation(scaleAnimation); //Out ScaleAnimation scaleAnimation = new ScaleAnimation(1f,0.5f,1f,.50f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); scaleAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); scaleAnimation.setDuration(1800); text.startAnimation(scaleAnimation);

Cara pembuatan Apps paling Populer

Create Stopwatch App in Android using Sketchware

TextInputLayout in Sketchware

How to enable download in webview in Sketchware apps?

Create Stopwatch App in Android using Sketchware

Code for implementing Notifications in Sketchware

A Flash Light App in Sketchware

Codes for modifying Action Bar in Sketchware

How to integrate Admob Ads in Sketchware project using AIDE?

How to find and​ highlight a word in a text field in Sketchware?

Firebase Login/Register with email verification