Latest 0.2.2
Homepage https://github.com/kgellci/Shift
License MIT
Platforms ios 8.0
Frameworks UIKit, CoreMotion
Authors

Swift
Platform
CI Status
Version
License
Platform

Shift_gif.gif
handle_logo_gradient.gif

Inspired by Pastel: https://github.com/cruisediary/Pastel

Shift allows you to do gradient color animations on your UI using either a timed animation or the device tilting motion.

You can also easily mask the gradient animation to images or text. Couple this with the motion based animation and
you will get an effect similar to the Robinhood app.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

let view = ShiftView()

// set colors
view.setColors([UIColor.orange,
UIColor.red,
UIColor.blue,
UIColor.purple])

// set animation duration
view.animationDuration(3.0)

// start animation
view.startTimedAnimation()

You can also start a motion based animation. The device accelerometer is used to shift the color as the device is tilted.
Note that accelerometers are not available is the simulator.

view.startMotionAnimation()

You can instantate a Button and animate the gradient color on the text only

This is similar to the gold reflection animations in the Robinhood app

shift_gold_gif.gif

let button = ShiftButton()
button.setTitle("Hello!", for: .normal)

// Custom gradient direction
button.start(shiftPoint: .topLeft)
button.end(shiftPoint: .bottomRight)

// Show the gradient on the text only
button.maskToText = true
button.startMotionAnimation()

Here is a list of available UI Classes

ShiftView()

// maskable to text or image
ShiftButton()

ShiftLabel()

// Maskable to text
ShiftMaskableLabel()

ShiftTextfield()

ShiftTextView()

// Maskable to image
ShiftImageView()

Each UI class has an Objective-C equivalent, just add _Objc to the class name, ShiftView_Objc

Requirements

Swift 4.0, iOS 8. Compatible with Obj-c

Installation

Shift is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "Shift"

Author

kgellci, [email protected], @kgellci

License

Shift is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "Shift",
    "version": "0.2.2",
    "summary": "Gradient Animation based on time or motion",
    "description": "Gradient Animation based on time or motion.nAbility fo mask gradient animations on text or images.",
    "homepage": "https://github.com/kgellci/Shift",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "kgellci": "[email protected]"
    },
    "source": {
        "git": "https://github.com/kgellci/Shift.git",
        "tag": "0.2.2"
    },
    "social_media_url": "https://twitter.com/kgellci",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Shift/Classes/**/*",
    "frameworks": [
        "UIKit",
        "CoreMotion"
    ],
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This