Giter Site home page Giter Site logo

jd-opensource / xanimation Goto Github PK

View Code? Open in Web Editor NEW
87.0 3.0 5.0 193 KB

使用 XAnimation, 你可以快速将设计师设计的lottie动效,应用到你的 App 中现有的任何视图(或图层)上

License: Apache License 2.0

Ruby 0.50% Objective-C 99.50%
bind-lottie-effect

xanimation's Introduction

XAnimation

CI Status Version License Platform

Introduce 简介 😊

使用 XAnimation, 你可以快速将设计师设计的动画效果,应用到你的 App 中现有的任何视图(或图层)上,由于 XAnimation 基于 Lottie 进行二次开源,因此它同样具备以下特征:

  • 高还原度 🎆
  • 少代码 ♻️
  • 高稳定性 💪

Example 效果预览

你可以在 Example 工程中体验它。

Requirements

iOS 9.0+

Installation 安装

XAnimation 可以通过 CocoaPods 来安装 (https://cocoapods.org) 只需要将下面代码加入到 Podfile 中。

pod install 'XAnimation'

API 使用

以下调示例为 UIView 绑定动画, CALayer 可以直接去源码看相关接口定义.

  1. 依赖头文件.
#import <XAnimation/UIView+XALottie.h>
#import <XAnimation/XABindLottieController.h>
  1. Lottie 绑定到一个根 UIView(或 CALayer)上.
/**
 * animationName 即为本地Json文件名
 * aView 你的任意一个视图
 */
[aView bindLottieWithAnimationNamed:@"牌子动画(旋转+位移+缩放)"];
  1. 你的视图绑定 Lottie json 中某个图层.
[aView bindLottieLayerName:@"牌子"];
  1. 播放动画.
[[aView currentBindController] play];

Future 展望

请试想,动画绑定的能力该如何运用呢?
每个人可能都有不同想法 🤔, 但这里有一个推荐,我现在对上面的流程做一点点改进,将 App 中的视图和 Lottie 中的图层的绑定关系,改为后台配置,这样流程看起来会像下图:

这样做的好处是:

  • 0 代码开发,任意时刻配置,可立即上线
  • 减少测试环节,由平台提供稳定性,提高效能

好了,现在你能想到哪些配置应用场景呢?比如:春节的时候🧨🧨🧨,让你的大 Icon 开心的跳起来?😄

Author 作者

wangxiyuan ([email protected])
如果你有更多更好的想法,欢迎发件交流 🤝🤝🤝。

License 版权

XAnimation is available under the Apache License 2.0. See the LICENSE file for more info.

xanimation's People

Contributors

xiyuanwang avatar

Stargazers

 avatar  avatar Fan'小陆 avatar Fan'小柒 avatar Harry Wang avatar JasonY avatar Yoon avatar  avatar Young for you avatar  avatar  avatar Rex Rao avatar  avatar An Ran avatar JackyYoung avatar  avatar ethanhua avatar  avatar  avatar  avatar  avatar  avatar Dream007 avatar Ice_Liu avatar dringxiong avatar  avatar  avatar comnslog avatar guobangbang avatar lee avatar  avatar 失落魔法 avatar  avatar  avatar sly avatar Mike avatar  avatar H3c avatar  avatar Jixiang Soong avatar mofechenyuan avatar Pop avatar CHEN ZHI KUAN avatar  avatar 邵兴国 avatar target avatar  avatar hubenkui avatar  avatar Sid avatar  avatar  avatar MurlocWan avatar  avatar 左丘木明 avatar  avatar GIllianR avatar  avatar  avatar jerry avatar xufeng avatar  avatar  avatar  avatar  avatar Ye Yating avatar  avatar  avatar  avatar Ternence Zhu avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar Liu Baoshuai avatar  avatar  avatar  avatar Lyddwn avatar Ron avatar  avatar SPIRIT BOY avatar Yellow.Zerooo avatar

Watchers

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