Giter VIP home page Giter VIP logo

motion-animator-objc's Issues

Bazel improvements

  • WORKSPACE should use http_archive instead of git_repository
  • Bump build_bazel_rules_apple to 0.1.0.

Add support for a static animator animate API

This would be similar to UIView's animate APIs:

MotionAnimator.animate(withTiming: timing) {

}

The implementation would simply create a throw-away motion animator instance and call through to the instance APIs.

Add didComplete parameter to the completion blocks

Adding support for explicit animations is trivial because we can do a one-to-one mapping of animations to completion handlers.

Adding support for implicit animations, however, is non-trivial because multiple animations map to the same completion handler. We'll have to implement the animation delegate on each added animation and coalesce the overall completion state into a single invocation of the completion handler.

This would bring our API closer in alignment to UIView's animation APIs.

Add support for relative timing

Consider the following spec:

struct MotionSpec spec = {
  .expand = {
    .verticalMovement = {
      .delay = 0.000, .duration = 0.350, .curve = EaseInEaseOut,
    },
    .scaling = {
      .delay = 0.000, .duration = 0.350, .curve = EaseInEaseOut,
    },
  },
  .collapse = {
    .verticalMovement = {
      .delay = 0.000, .duration = 0.350, .curve = EaseInEaseOut,
    },
    .scaling = {
      .delay = 0.000, .duration = 0.350, .curve = EaseInEaseOut,
    },
  },
};

All of the animations are described in relation to a relative timeline. If the timing could correspondingly be described in a relative fashion, our struct might look like this:

struct MotionSpec spec = {
  .expand = {
    .verticalMovement = {
      .delay = 0.0, .duration = 1.0, .curve = EaseInEaseOut,
    },
    .scaling = {
      .delay = 0.0, .duration = 1.0, .curve = EaseInEaseOut,
    },
  },
  .collapse = {
    .verticalMovement = {
      .delay = 0.0, .duration = 1.0, .curve = EaseInEaseOut,
    },
    .scaling = {
      .delay = 0.0, .duration = 1.0, .curve = EaseInEaseOut,
    },
  },
};

animator.relativeTimingDuration = 0.350;

All animation timing would correspondingly be multiplied by the relativeTimingDuration.

Add support for relative values

Values passed to the animator are currently absolute. It would be nice to also be able to provide relative values.

// Move a view 50 points down.
    [animator animateWithTiming:timing
                        toLayer:view.layer
             withRelativeValues:@[ @0, @50 ]
                        keyPath:MDMKeyPathY];

This feature should take care when implementing support for shouldReverseValues.

Explore routing implicit animations through CAAction rather than our own internal record keeping

We may find it beneficial to to implement CAAction so that our animations get routed through the expected action architecture. The challenge is that we need to be able to provide the timing struct to the action implementation and that action implementation needs to be able to create an animation object using the animator's configurations. This may require splitting the animator's animation creation logic out to some standalone method.

Some references:

Returning `NSNull` for swapped animation implementations causes crash

In the method, ActionForKey(CALayer *layer, SEL _cmd, NSString *event), the returned NSNull value was causing crashes because it does not respond to selectors (like runAction:forKey:). This is easily reproduced when running the unit test suite on iOS 8.2 or lower simulators. The contract for actionForKey: should return nil if no action was found, which is what we want in this case.

Crash when completion blocks are `nil` for "legacy" API

Calling either of these two methods with a nil completion block will crash.

 [animator animateWithTiming:timing
                   animations:animations
                   completion:nil];

[animator animateWithTiming:timing
                       toLayer:aLayer
                    withValues:values
                      keyPath:keyPath
                   completion:nil];

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.