Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 184.108.40.206 release ready!
Owner and Founder. Opencart
In this blog, we are going to learn some cool features of motion layout. Image filtration is one of them.
Motion Layout is a new class available in the ConstraintLayout 2.0 library. By using this class we can manage motion and widget animation in their application.
First of all, we have to implement dependency.
Implement this in your build.greadle (app) file.
Now open your layout file in my case it is activity_main.xml.
In this layout file, We have MotionLayout as a view group and ImageFilterView as a child view. To perform Image filtration we need to use ImageFilterView.
In this layout file, we use layoutDescription attribute and parse a layout file motion demo_motion in it. Because layoutDesciption holds a reference of your motion_scene layout file.
This is the file that defines the type of motion/animation we want and what the starting/ending constraints are.
Here we defined a Transition (the animation) with duration & a start/endpoint to the layouts. And also a swipe Trigger on the image (with up direction) — which adds interactivity.
Specifying the saturation can be done simply by using a CustomAttribute:
Therefore we define saturation values 1 and 0 to get the filter effect.
As a result of saturation manipulation, we get a filter effect on our image.
We define two ConstraintSet children in our xml. Start and end positions of that image.
Finally, we have achieved Image filtration with motion layout.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.