Giter VIP home page Giter VIP logo

mcanimationview's Introduction

MCAnimationView

Build Status Coverage Status Badge w/ Version Badge w/ Platform

UIImageView alternative for animations that doesn't need to load all the images in memory at once and provide a callback when animation is done.

Example Usage

- (void)funWithAnimations
{
  /*
    Load 48 images in images array for animation.
    load0001.png
    load0002.png
    ...
    load0048.png
  */
  NSUInteger quantity = 48;
  NSMutableArray* images = [@[] mutableCopy];
  for (NSUInteger index=1; index<=quantity; index++) {
    NSString* imageName = [NSString stringWithFormat:@"load%04d.png", index];
    [images addObject:imageName];
  }

  /*
    Create the animation view and use it.
  */
  MCAnimationView* animationView = [[MCAnimationView alloc] initWithFrame:CGRectZero];
  [animationView setAnimation:images];
  [animationView setAnimationDuration:2.0f]; // 2 seconds,
  [self.view addSubview: animationView];

  /*
    Start the animation
  */
  [animationView playAnimationRepeatCount:5 willPlayBlock:^(NSUInteger repetition) {
    // Animation will play
  } didPlayBlock:^(NSUInteger repetition) {
    // Animation done playing
  }];

  /*
    When you're done playing it.
  */
  [animationView stopAnimations];
}

Adding to your project

If you're using CocoaPods, there's nothing simpler. Add the following to your Podfile and run pod install

pod 'MCAnimationView', :git => 'https://github.com/mirego/MCAnimationView.git'

Don't forget to #import "MCAnimationView.h" where it's needed.

License

MCAnimationView is © 2016 Mirego and may be freely distributed under the New BSD license. See the LICENSE.md file.

About Mirego

Mirego is a team of passionate people who believe that work is a place where you can innovate and have fun. We're a team of talented people who imagine and build beautiful Web and mobile applications. We come together to share ideas and change the world.

We also love open-source software and we try to give back to the community as much as we can.

mcanimationview's People

Contributors

flambert avatar p-l avatar remi avatar

Stargazers

Nicholas Pacholski avatar  avatar Emanuele Sabetta avatar Pavel 'Pasha' Mazurin avatar Sergei avatar  avatar João Prado Maia avatar SuperFancy avatar 6david9 avatar Willi Wu avatar Nickolay Sheika avatar Nick Pannuto avatar  avatar Romain Briche avatar  avatar Jean-David Tremblay avatar

Watchers

 avatar Samuel Garneau avatar Marc Lefrancois avatar Simon Gingras avatar  avatar Charles Demers avatar Lea Rhéaume avatar Mathieu Côté avatar James Cloos avatar Pascal Hamel avatar Vincent Roy Chevalier avatar Dominic Plouffe avatar Martin Bonneville avatar Luc Bernard avatar Olivier Cartier avatar Eric Tremblay avatar  avatar Sylvain Boucher avatar Charles-Olivier Demers avatar Alexandre Diez-Breton avatar Francis avatar Mathieu Baron avatar  avatar Marc-Antoine Ruel avatar Felix Lapalme avatar Charles Montigny avatar Benoit SIDA avatar Emon Dhar avatar  avatar  avatar Steve Matte avatar Olivier Pineau avatar Pascal Martel avatar Brandon Roberge avatar Philippe Dupuis avatar Valdèse Kamdem avatar Vincent Ribou avatar Carl Dubreuil avatar Raphaël Blanchet avatar David Bilodeau avatar Thomas Duplaix avatar steven de Tilly avatar Catherine Lamonde avatar Nathaniel Simard avatar Sébastien Garvin avatar Olivier Provost avatar Luc Dion avatar Julien Laplante avatar Andréanne Guay avatar Marie-Pierre Tremblay avatar Eric Certosini avatar Vincent Legros avatar Philippe Lachance avatar Alexandre Brillant avatar Alexander Pawinski avatar  avatar Matthew Kevork avatar

mcanimationview's Issues

Crashes when passing array to animationView

I have the animation working with just a uiimageviewanimation and was trying this library out to stop the memory jump, but it is crashing.

naming convention: one-1.png, one-2.png

NSMutableArray *arrayOfImages = [[NSMutableArray alloc] init];
for(int i=1;i<=29;i++) {
    UIImage *img = [UIImage imageNamed:[NSString stringWithFormat:@"one-%d.png",i]];
    [arrayOfImages addObject:img];
}

animationView = [[MCAnimationView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.frame.size.width, self.view.frame.size.height)];
[animationView setAnimation:arrayOfImages];
[animationView setAnimationDuration:1.0f];

crashes:

2014-06-20 12:22:03.061 Vaska App[1098:60b] -[UIImage pathExtension]: unrecognized selector sent to instance 0x17808af50
2014-06-20 12:22:03.067 Vaska App[1098:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImage pathExtension]: unrecognized selector sent to instance 0x17808af50'

add to subview and image size(retina)

two more issues

make sure to [self.view addSubview: animationView]; in documentation

also, my images are retina and showing at double resolution not the width and height of view even though im displaying it at that.

the imageview should adopt the width/height passed it.

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.