GithubHelp home page GithubHelp logo

isabella232 / fan-menu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from exyte/fan-menu

0.0 0.0 0.0 100.07 MB

Menu with a circular layout based on Macaw

License: MIT License

Swift 96.04% Ruby 2.38% Objective-C 1.58%

fan-menu's Introduction

FanMenu

Easily customizable floating circle menu created with Macaw


We are a development agency building phenomenal apps.




Travis CI Version Carthage Compatible License Platform Twitter

Usage

  1. Create UIView in your storyboard or programatically.
  2. Set FanMenu as UIView class.
  3. Set the button
fanMenu.button = FanMenuButton(
    id: "main",
    image: "plus",
    color: Color(val: 0x7C93FE)
)
  1. Set menu items
fanMenu.items = [
    FanMenuButton(
        id: "exchange_id",
        image: "exchange",
        color: Color(val: 0x9F85FF)
    ),
    ...
    FanMenuButton(
        id: "visa_id",
        image: "visa",
        color: Color(val: 0xF55B58)
    )
]
  1. Add an event handler
// call before animation
fanMenu.onItemDidClick = { button in
    print("ItemDidClick: \(button.id)")
}
// call after animation
fanMenu.onItemWillClick = { button in
    print("ItemWillClick: \(button.id)")
}
  1. Configure optional parameters
// distance between button and items
fanMenu.menuRadius = 90.0

// animation duration
fanMenu.duration = 0.35

// menu opening delay
fanMenu.delay = 0.05

// interval for buttons in radians
fanMenu.interval = (0, 2.0 * M_PI)

// menu background color
fanMenu.menuBackground = Color.red
  1. Useful methods
fanMenu.isOpen
fanMenu.open()
fanMenu.close()

Customization

FanMenu is created with Macaw, our vector graphics Swift library. Thanks to that, it can be easily modified and improved for your purposes.

All source code is located in one single file called FanMenu.swift. To modify the menu simply copy this file and apply necessary changes.

Examples

To try out the FanMenu examples:

  • Clone the repo git clone [email protected]:exyte/fan-menu.git
  • Open terminal and run cd <FanMenuRepo>/Example
  • Run pod install to install all dependencies
  • Run xed . to open project in the Xcode
  • Try it!

We have the following examples:

Installation

CocoaPods

pod 'FanMenu'

Carthage

github 'Exyte/fan-menu'

Manually

Drop FanMenu.swift into your project.

Requirements

  • iOS 9.0+ / macOS 10.12+
  • Xcode 10.2+

fan-menu's People

Contributors

amarunko avatar f3dm76 avatar hugosay avatar shipinev avatar vhailor13 avatar ystrot avatar zapletnev avatar zocario avatar

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.