Add the following to your project level build.gradle:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Add this to your app build.gradle:
dependencies {
implementation 'com.github.annchar:ScalingAnimationDroid:1.0.0'
}
ScalingAnimationDroid
is really easy to use. The library gives to your Views a beautiful touch effect.
Some of material widgets needs to be casted to View, otherwise it will show Type mismatch
warning.
ScalingAnimationDroid(textview_title) // Use attributes by default
ScalingAnimationDroid(button_search) // Use attributes by default
// Custom Attributes
ScalingAnimationDroid(card_view1).apply {
setScalingAnimationType(ScalingAnimationType.SCALING_IN)
setDurationActionDown(400)
setDurationActionUp(400)
setScalingPadding(0.8f)
}
// OR
val animateView = ScalingAnimationDroid(card_view1)
animateView.setScalingAnimationType(ScalingAnimationType.SCALING_IN)
animateView.setDurationActionDown(400)
animateView.setDurationActionUp(400)
animateView.setScalingPadding(0.8f)
After views are binded simply pass the name of widget to ScalingAnimationDroid
constructor.
new ScalingAnimationDroid(textview_title); // Use attributes by default
new ScalingAnimationDroid(button_search); // Use attributes by default
// Custom Attributes
ScalingAnimationDroid animateView = new ScalingAnimationDroid(card_view1);
animateView.setScalingAnimationType(ScalingAnimationType.SCALING_IN);
animateView.setDurationActionDown(400);
animateView.setDurationActionUp(400);
animateView.setScalingPadding(0.8f);
Attribute | Description | Default |
---|---|---|
Scaling animation type (ScalingAnimationType) | The type of animation. | ScalingAnimationType.SCALING_IN |
Duration action down (Int) | Time to control animate for your touch. | 400 (milliseconds) |
Duration action up (Int) | Time to control animate for move on. | 400 (milliseconds) |
Scaling padding (Float) | Alpha degree value between 0.0f and 1.0f | 0.8f |
Copyright 2020 ChanoknadM
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.