Convert Figma logo to code with AI

Yalantis logoGuillotineMenu-Android

Neat library, that provides a simple way to implement guillotine-styled animation

2,724
495
2,724
9

Top Related Projects

You can easily add awesome animated context menu to your app.

Side menu with some categories to choose.

4,015

Phoenix Pull-to-Refresh

2,230

User Profile Interface Animation

4,015

Phoenix Pull-to-Refresh

Quick Overview

GuillotineMenu-Android is an Android library that provides a unique and visually appealing menu animation inspired by the Guillotine. It offers a smooth transition effect where the menu appears to "slice" into view from the top of the screen, providing an engaging user experience for Android applications.

Pros

  • Visually striking and unique menu animation
  • Easy to integrate into existing Android projects
  • Customizable appearance and behavior
  • Smooth performance and optimized for Android

Cons

  • May not fit all app designs or user experience patterns
  • Limited to top-down animation style
  • Requires careful consideration of menu item placement
  • Potential overuse could lead to user fatigue

Code Examples

  1. Basic implementation of GuillotineMenu:
val guillotineMenu = GuillotineAnimation.from(toolbar)
    .setStartDelay(250)
    .setDuration(500)
    .setClosedOnStart(true)
    .build()
  1. Customizing the animation:
val guillotineMenu = GuillotineAnimation.from(toolbar)
    .setStartDelay(250)
    .setDuration(500)
    .setClosedOnStart(true)
    .setInterpolator(LinearInterpolator())
    .setGuillotineListener(object : GuillotineListener {
        override fun onGuillotineOpened() {
            // Handle menu opened event
        }
        override fun onGuillotineClosed() {
            // Handle menu closed event
        }
    })
    .build()
  1. Triggering the menu programmatically:
// Open the menu
guillotineMenu.open()

// Close the menu
guillotineMenu.close()

Getting Started

  1. Add the dependency to your build.gradle file:
dependencies {
    implementation 'com.yalantis:guillotine:1.2.5'
}
  1. Add the GuillotineMenu to your layout XML:
<com.yalantis.guillotine.view.GuillotineMenuFrameLayout
    android:id="@+id/guillotine_menu"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/guillotine_background">

    <!-- Add your menu items here -->

</com.yalantis.guillotine.view.GuillotineMenuFrameLayout>
  1. Initialize the GuillotineMenu in your Activity or Fragment:
val toolbar = findViewById<Toolbar>(R.id.toolbar)
val guillotineMenu = findViewById<GuillotineMenuFrameLayout>(R.id.guillotine_menu)

val guillotineAnimation = GuillotineAnimation.from(toolbar)
    .setStartDelay(250)
    .setDuration(500)
    .setClosedOnStart(true)
    .build()

Competitor Comparisons

You can easily add awesome animated context menu to your app.

Pros of Context-Menu.Android

  • More versatile and customizable menu options
  • Smoother animations and transitions
  • Better suited for complex menu structures

Cons of Context-Menu.Android

  • Slightly more complex implementation
  • May require more setup time for basic use cases
  • Potentially higher resource usage due to advanced animations

Code Comparison

Context-Menu.Android:

MenuAdapter<MenuObject> menuAdapter = new MenuAdapter<>(list, context);
MenuParams menuParams = new MenuParams();
menuParams.setActionBarSize((int) getResources().getDimension(R.dimen.tool_bar_height));
menuParams.setMenuObjects(getMenuObjects());
menuParams.setClosableOutside(false);
mMenuDialogFragment = ContextMenuDialogFragment.newInstance(menuParams);

GuillotineMenu-Android:

new GuillotineAnimation.GuillotineBuilder(guillotineMenu, guillotineMenu.findViewById(R.id.guillotine_hamburger), contentHamburger)
        .setStartDelay(RIPPLE_DURATION)
        .setActionBarViewForAnimation(toolbar)
        .setClosedOnStart(true)
        .build();

The code snippets demonstrate that Context-Menu.Android requires more setup and configuration, while GuillotineMenu-Android has a simpler implementation. Context-Menu.Android offers more customization options, but GuillotineMenu-Android provides a quicker setup for its specific menu style.

Both libraries are developed by Yalantis and offer unique menu animations for Android applications. The choice between them depends on the specific design requirements and complexity of the menu structure needed for the project.

Side menu with some categories to choose.

Pros of Side-Menu.Android

  • More customizable with various animation options
  • Supports both left and right side menu configurations
  • Easier to integrate into existing projects due to its modular design

Cons of Side-Menu.Android

  • Slightly more complex implementation compared to GuillotineMenu-Android
  • May require more fine-tuning to achieve desired visual effects
  • Limited to side-sliding menu animations

Code Comparison

Side-Menu.Android:

val menuParams = SlideAndFadeMenuLayoutParams(
    240,
    ViewGroup.LayoutParams.MATCH_PARENT,
    Gravity.LEFT
)
slideAndFadeMenuLayout.setParameters(menuParams)

GuillotineMenu-Android:

val guillotineAnimation = GuillotineAnimation.from(toolbar)
    .setStartDelay(250)
    .setDuration(500)
    .setInterpolator(BounceInterpolator())
    .build()

Both libraries offer unique menu animations for Android applications. Side-Menu.Android provides more flexibility in terms of customization and positioning, making it suitable for a wider range of projects. However, it may require more setup time compared to GuillotineMenu-Android.

GuillotineMenu-Android offers a distinctive guillotine-style animation, which can be eye-catching and unique. It's generally easier to implement but has fewer customization options.

The code snippets demonstrate the different approaches: Side-Menu.Android uses a more configurable setup, while GuillotineMenu-Android focuses on a specific animation style with simpler implementation.

4,015

Phoenix Pull-to-Refresh

Pros of Phoenix

  • Offers a pull-to-refresh animation, which is a widely used and expected feature in mobile apps
  • More versatile and can be applied to various UI elements, not just menus
  • Provides a smoother and more fluid animation experience

Cons of Phoenix

  • May require more setup and customization for specific use cases
  • Could potentially have a higher performance impact due to complex animations
  • Less suitable for apps requiring a unique or unconventional navigation pattern

Code Comparison

Phoenix:

mPullToRefreshView.setOnRefreshListener {
    // Your refresh logic here
    mPullToRefreshView.postDelayed({
        mPullToRefreshView.setRefreshing(false)
    }, 2000)
}

GuillotineMenu-Android:

val guillotineMenu = GuillotineAnimation.GuillotineBuilder(
    guillotineMenu,
    guillotineMenu.findViewById(R.id.guillotine_hamburger),
    contentHamburger
)
    .setStartDelay(250)
    .setActionBarViewForAnimation(toolbar)
    .build()

Phoenix focuses on implementing a pull-to-refresh feature with customizable animations, while GuillotineMenu-Android provides a unique menu animation resembling a guillotine. Phoenix is more suitable for general-purpose refresh animations, whereas GuillotineMenu-Android offers a specific, eye-catching menu transition effect. The choice between the two depends on the app's design requirements and the desired user interaction pattern.

2,230

User Profile Interface Animation

Pros of Euclid

  • More versatile UI component, offering a profile card animation
  • Provides a smoother and more complex animation effect
  • Can be integrated into various parts of an app, not just as a menu

Cons of Euclid

  • Potentially more complex to implement and customize
  • May have a steeper learning curve for developers
  • Limited to specific use cases (profile cards) compared to a general menu solution

Code Comparison

GuillotineMenu-Android:

GuillotineAnimation.Builder(guillotineMenu, guillotineMenu.findViewById(R.id.guillotine_hamburger), contentHamburger)
    .setStartDelay(RIPPLE_DURATION)
    .setActionBarViewForAnimation(toolbar)
    .setClosedOnStart(true)
    .build()

Euclid:

val profileView = EuclidView.Builder()
    .withContext(this)
    .withProfileLayout(R.layout.profile_view)
    .withListLayout(R.layout.list_view)
    .build()

Both libraries offer unique animation effects for Android applications. GuillotineMenu-Android focuses on providing a distinctive menu animation, while Euclid offers a profile card animation component. The choice between the two depends on the specific UI requirements of your application. GuillotineMenu-Android may be more suitable for apps requiring a unique navigation menu, while Euclid could be better for apps with user profile features needing an engaging animation.

4,015

Phoenix Pull-to-Refresh

Pros of Phoenix

  • Offers a pull-to-refresh animation, which is a widely used and expected feature in mobile apps
  • More versatile and can be applied to various UI elements, not just menus
  • Provides a smoother and more fluid animation experience

Cons of Phoenix

  • May require more setup and customization for specific use cases
  • Could potentially have a higher performance impact due to complex animations
  • Less suitable for apps requiring a unique or unconventional navigation pattern

Code Comparison

Phoenix:

mPullToRefreshView.setOnRefreshListener {
    // Your refresh logic here
    mPullToRefreshView.postDelayed({
        mPullToRefreshView.setRefreshing(false)
    }, 2000)
}

GuillotineMenu-Android:

val guillotineMenu = GuillotineAnimation.GuillotineBuilder(
    guillotineMenu,
    guillotineMenu.findViewById(R.id.guillotine_hamburger),
    contentHamburger
)
    .setStartDelay(250)
    .setActionBarViewForAnimation(toolbar)
    .build()

Phoenix focuses on implementing a pull-to-refresh feature with customizable animations, while GuillotineMenu-Android provides a unique menu animation resembling a guillotine. Phoenix is more suitable for general-purpose refresh animations, whereas GuillotineMenu-Android offers a specific, eye-catching menu transition effect. The choice between the two depends on the app's design requirements and the desired user interaction pattern.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Guillotine animation

Neat library, that provides a simple way to implement guillotine-styled animation

Yalantis

Android Arsenal

Android Gems

Check this [project on Dribbble] (https://dribbble.com/shots/2018249-Guillotine-Menu)

Also, read how it was done in [our blog] (https://yalantis.com/blog/how-we-developed-the-guillotine-menu-animation-for-android/?utm_source=github)

Guillotine animation gif

Usage

For a working implementation, have a look at the app module

  1. Add JitPack repository in your root build.gradle at the end of repositories:

    allprojects {
        repositories {
            ...
            maven { url "https://jitpack.io" }
        }
    }
    
    
  2. Add the dependency to your app build.gradle

    dependencies {
        compile 'com.github.Yalantis:GuillotineMenu-Android:1.2'
    }
    
  3. You need to create a layout for the navigation menu (guillotine.xml in sample app), which will later open and close guillotine-style. The only tricky part here is that the navigation layout should be on top of any other content and will disappear after closing animation ends. That is why content layout (activity.xml in sample app) should also have hamburger icon at the same coordinates as navigation menu has.

  4. After that all you need to do is to build animation by passing navigation layout object, navigation and content layout hamburger objects to GuillotineAnimation.GuillotineBuilder in your onCreate method

    new GuillotineAnimation.GuillotineBuilder(guillotineMenu, guillotineMenu.findViewById(R.id.guillotine_hamburger), contentHamburger)
                .setActionBarViewForAnimation(toolbar)
                .build();
    

Here setActionBarViewForAnimation method enables bounce effect of Toolbar at the end of the guillotine closing animation.

Misc

Builder allows you to customize start delay, duration, interpolation and you can set listener if you want to do staff at the moment when menu has been opened or closed.

Compatibility

  • Android 4.0.3 Ice Cream Sandwich (API level 15)

Changelog

Version: 1.0

  • Initial Build

Version: 1.2

  • Moved to using Toolbar instead of ActionBar
  • Updated Gradle versions
  • Fixed bugs

Let us know!

We’d be really happy if you sent us links to your projects where you use our component. Just send an email to github@yalantis.com And do let us know if you have any questions or suggestion regarding the animation.

P.S. We’re going to publish more awesomeness wrapped in code and a tutorial on how to make UI for Android (iOS) better than better. Stay tuned!

License

Copyright 2017, Yalantis

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.