GithubHelp home page GithubHelp logo

Comments (7)

christophesmet avatar christophesmet commented on July 19, 2024

Probably because the view is being invalidated every time.
You can profile the code and see if there is a possiblity to cache the bitmap.
Is there a sample I can run ?
I don't think automatically caching and breaking the invalidate function would be a good idea.
I suggest you look at bitmap shaders.
Does this answer your question ?

from android_maskable_layout.

Morteza-Rastgoo avatar Morteza-Rastgoo commented on July 19, 2024

This is a library that you can try here https://github.com/Q42/AndroidScrollingImageView

 <com.q42.android.scrollingimageview.ScrollingImageView
        android:layout_width="match_parent"
        android:layout_height="250dp"
        android:layout_gravity="bottom"
        scrolling_image_view:speed="0.25dp"
        scrolling_image_view:src="@drawable/world_map" />

and put it in your MaskableFrameLayout.

from android_maskable_layout.

christophesmet avatar christophesmet commented on July 19, 2024

Well, thats normal. The view is invalidated each time, causing it to mask every time.
Every time it scrolls it invalidates, the mask is being applied.
So this will be very slow.
Either decrease the amount of invalidates or use bitmap shaders.

from android_maskable_layout.

Morteza-Rastgoo avatar Morteza-Rastgoo commented on July 19, 2024

I also use other views like Frame layout inside MaskableFrameLayout and i animate the views inside frame layout and animations are slow there too. The reason that i use this great library is that it makes it available to mask any view!
is there a workaround that it perform better in animations?
I am not familiar with shaders, how can i use an implementation?

from android_maskable_layout.

christophesmet avatar christophesmet commented on July 19, 2024

Your animation will invalidate each time, causing a masking operation to be executed every time.
Optimize your animation or profile your code.

from android_maskable_layout.

Morteza-Rastgoo avatar Morteza-Rastgoo commented on July 19, 2024

I appreciate, If you can help me. I have two different views with different animations inside two maskable layout. In first one, i need to simulate a world map sphere movement in a loop so i used this lib(https://github.com/Q42/AndroidScrollingImageView):

 <com.q42.android.scrollingimageview.ScrollingImageView
    android:layout_width="match_parent"
    android:layout_height="250dp"
    android:layout_gravity="bottom"
    scrolling_image_view:speed="0.25dp"
    scrolling_image_view:src="@drawable/world_map" />

in second one i just have move and scale animations but i use this (https://github.com/daimajia/AndroidViewAnimations) library for implemented animations

  private void animateLines() {
    new Handler().postDelayed(() -> hideLineViews(false), 20);
    YoYo.with(Techniques.SlideInRight)
            .duration(lineAnimationDuration)
            .interpolate(new LinearInterpolator())
            .playOn(lines[1]);
    YoYo.with(Techniques.SlideInUp)
            .duration(lineAnimationDuration)
            .interpolate(new LinearInterpolator())
            .playOn(lines[0]);
}

private void animateExtensions() {
    new Handler().postDelayed(() -> hideExtensionViews(false), 40);
    for (View v : extensions) {
        YoYo.with(Techniques.ZoomIn)
                .duration(lineAnimationDuration)
                .interpolate(new LinearInterpolator())
                .playOn(v);
    }
}

What is your suggestion?

from android_maskable_layout.

christophesmet avatar christophesmet commented on July 19, 2024

Use bitmap shaders.
You are masking the view each time is animates.
That is really cpu intensive.
Maybe try using the hardware layer, but I doubt that will work.
I recommend looking into bitmap shaders.

from android_maskable_layout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.