Git Product home page Git Product logo

magicpie's Introduction

MagicPie

Powerful pie layer for creating your own pie view. PieLayer provide great animation with simple usage.

The main advantage of that control that there is no worry about displaying of animation. Animation will display correctly even if you will add new elements during execution of another slice deleting animation. That's amazing! And here is no delegates. I like delegates, but in this case I think they are excess.

Demo

Demo

Be creative =)

Demo

Demo

Installation

Edit your PodFile to include the following line:

pod 'MagicPie'

Then import the main header.

#import <MagicPieLayer.h>

Have a fun!

Swift Swift Swift Swift Swift

Okay, now when you are reading this, I recommend to you look the example #2 in Swift.

Example Usage

Create pie:

Obj-C
PieLayer* pieLayer = [[PieLayer alloc] init];
pieLayer.frame = CGRectMake(0, 0, 200, 200);
[self.view.layer addSublayer:pieLayer];
Swift
let pieLayer = PieLayer()
pieLayer.frame = CGRectMake(0, 0, 200, 200)
view.layer.addSublayer(pieLayer)

Add slices:

Obj-C
[pieLayer addValues:@[[PieElement pieElementWithValue:5.0 color:[UIColor redColor]],
                      [PieElement pieElementWithValue:4.0 color:[UIColor blueColor]],
                      [PieElement pieElementWithValue:7.0 color:[UIColor greenColor]]] animated:YES];
Swift
pieLayer.addValues([PieElement(value: 5.0, color: UIColor.redColor()),
                    PieElement(value: 4.0, color: UIColor.blueColor()),
                    PieElement(value: 7.0, color: UIColor.greenColor())], animated: true)

Change value with animation:

Obj-C
PieElement* pieElem = pieLayer.values[0];
[PieElement animateChanges:^{
	pieElem.val = 13.0;
	pieElem.color = [UIColor yellowColor];
}];
Swift
let pieElem = pieLayer.values[0]
PieElement.animateChanges {
	pieElem.val = 13.0
	pieElem.color = UIColor.yellowColor()
}

Delete slices:

Obj-C
[pieLayer deleteValues:@[pieLayer.values[0], pieLayer.values[1]] animated:YES];
Swift
pieLayer.deleteValues([pieLayer.values[0], pieLayer.values[1]], animated: true)

Contact

Alexandr Graschenkov: [email protected]

License

MagicPie is available under the MIT license.

Copyright © 2013 Alexandr Graschenkov.

magicpie's People

Contributors

alexandrgraschenkov avatar dlajarretie avatar gogopair avatar paulz avatar

Watchers

 avatar  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.