Coder Social home page Coder Social logo

material-motion / motion-animator-objc Goto Github PK

View Code? Open in Web Editor NEW
53.0 53.0 18.0 737 KB

A Motion Animator creates performant, interruptible iOS animations from motion specs.

License: Apache License 2.0

Ruby 0.96% Objective-C 51.80% Swift 46.33% Shell 0.91%
animation cocoapods core-animation ios motion swift

motion-animator-objc's Introduction

layout permalink
default
/

Material Motion

Welcome to the Material Motion documentation site. Please check out the Starmap for our engineering specification and our Team documentation to learn more about our culture.

Current status: early development.

Chat Chat with us on Discord.

Android platform support

Library Build status Coverage Version Docs Issues
conventions-android Build Status codecov Release Docs Open issues
gestures-android Build Status codecov Release Docs Open issues
indefinite-observable-android Build Status codecov Release Docs Open issues
material-motion-android Build Status codecov Release Docs Open issues
material-motion-rebound-android Build Status codecov Release Docs Open issues
physics-android Build Status codecov Release Docs Open issues

Apple platform support

Library Build status Coverage Version Platforms Docs Issues
conventions-objc Build Status codecov CocoaPods Compatible Platform Docs Open issues
indefinite-observable-swift Build Status codecov CocoaPods Compatible Platform Docs Open issues
material-motion-pop-swift Build Status codecov CocoaPods Compatible Platform Docs Open issues
material-motion-swift Build Status codecov CocoaPods Compatible Platform Docs Open issues

Web platform support

Library Build status Coverage Version Issues
indefinite-observable-js Build Status codecov Release Open issues
material-motion-js Build Status codecov Release Open issues

Misc libraries

Library Build status Coverage Version Issues
apidiff Build Status codecov Release Open issues
loopy Build Status codecov Release Open issues
material-motion Build Status codecov Release Open issues
milemarker Build Status codecov Release Open issues
starmap Build Status codecov Release Open issues
sublime Build Status codecov Release Open issues
tools Build Status codecov Release Open issues
tsc-reduction Build Status codecov Release Open issues

motion-animator-objc's People

Contributors

arcank avatar jverkoey avatar sdefresne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

motion-animator-objc's Issues

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.

Bazel improvements

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

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:

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.

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.

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.

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.