All Projects → Trxy → Trx

Trxy / Trx

Licence: mit
Squeeze, chain, overlap, seek. A powerful swift animation framework

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Trx

SwiftUI-DesignCode
 SwiftUI-DesignCode is some examples in the process of learning swiftUI 2.0
Stars: ✭ 185 (+60.87%)
Mutual labels:  apple-tv, ios-animation
Tkdotsegment
TKDotSegment is a segment with dot animation
Stars: ✭ 103 (-10.43%)
Mutual labels:  ios-animation
Macaw
Powerful and easy-to-use vector graphics Swift library with SVG support
Stars: ✭ 5,756 (+4905.22%)
Mutual labels:  ios-animation
Lihalert
Advance animated alerts for iOS written in Swift
Stars: ✭ 34 (-70.43%)
Mutual labels:  ios-animation
Open Source Ios Apps
📱 Collaborative List of Open-Source iOS Apps
Stars: ✭ 28,826 (+24966.09%)
Mutual labels:  apple-tv
Loadingshimmer
An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator.
Stars: ✭ 1,180 (+926.09%)
Mutual labels:  ios-animation
Awesome Smart Tv
⚡️A curated list of awesome resources for building Smart TV apps
Stars: ✭ 588 (+411.3%)
Mutual labels:  apple-tv
Stagehand
Modern, type-safe API for building animations on iOS
Stars: ✭ 108 (-6.09%)
Mutual labels:  ios-animation
Tkrubberindicator
A rubber animation pagecontrol
Stars: ✭ 1,337 (+1062.61%)
Mutual labels:  ios-animation
Tvml Catalog Using Atvjs
Port of the TVML Catalog Sample Code re-written using atvjs
Stars: ✭ 34 (-70.43%)
Mutual labels:  apple-tv
Tkswitchercollection
An animation switch collection
Stars: ✭ 877 (+662.61%)
Mutual labels:  ios-animation
Cariocamenu
The fastest zero-tap iOS menu.
Stars: ✭ 785 (+582.61%)
Mutual labels:  ios-animation
Fsdairportfliplabel
UILabel like old Airport flipping labels
Stars: ✭ 79 (-31.3%)
Mutual labels:  ios-animation
Marshal
Marshaling the typeless wild west of [String: Any]
Stars: ✭ 694 (+503.48%)
Mutual labels:  apple-tv
Nvactivityindicatorview
A collection of awesome loading animations
Stars: ✭ 10,031 (+8622.61%)
Mutual labels:  ios-animation
Iosproject
iOS project of collected some demos for iOS App, use Objective-C
Stars: ✭ 5,357 (+4558.26%)
Mutual labels:  ios-animation
Homeassistant
Example Home Assistant Configs
Stars: ✭ 846 (+635.65%)
Mutual labels:  apple-tv
Sizeslidebutton
A fun Swift UIControl for picking a size
Stars: ✭ 46 (-60%)
Mutual labels:  ios-animation
Canijailbreak.com
a website which tells you whether you can jailbreak your iOS device.
Stars: ✭ 112 (-2.61%)
Mutual labels:  apple-tv
Awesome Ios
A curated list of awesome iOS ecosystem, including Objective-C and Swift Projects
Stars: ✭ 38,720 (+33569.57%)
Mutual labels:  ios-animation

TRX

Build Status CocoaPods Carthage License Swift

TRX is a versatile animation framework built with ease of use, powerful features and performance in mind. TRX is inspired by the excellent JavaScript animation framework GSAP.

This version is works with Swift 4. For Swift 3 compatible version use 0.5.0.

Key Features

  • Animate any numerical value
  • Chain, overlap and group Tweens into Timelines
  • Squeeze and stretch Tweens and Timelines
  • Have total control, pause, play, seek any Tween or Timeline

Examples

Tricks

Take a look at Tricks the example app.

Using TRX

Basic Usage

Tween any value

Tween(from: 0, to: 20, time: 0.3) {
  object.value = $0
}.start()

Or, neater...

1.trx(to: 20) { object.value = $0 }.start()

Tween Double, CGFloat, CGPoint, CGSize, CGRect, CGAffineTransform, CATransform3D or even your own type (by extending the Morphable Protocol)

Tween(from: CGPoint.zero, to: CGPoint(x: 20, y: 15), time: 0.3) {
  layer.position = $0
}.start()

Use optional parameters for fine-grained control

Tween(from: 0,
      to: 1,
      time: 0.3,
      delay: 0.1,
      ease: Ease.Elastic.easeOut,
      key: "MyOwnKey",
      onStart: { print("start") },
      onComplete: { done in print("complete and done: \(done)") }) { value in
        object.value = value
}.start()
  • from: Starting value (Morphable).
  • to: End value (Morphable).
  • time: Duration (NSTimeInterval).
  • delay: optional Time offset (NSTimeInterval). Defaults to 0.
  • ease: optional Timing function (Ease.TimingFunction). Defaults to Ease.Quad.easeOut.
  • key: optional Tween key (String). Any other running animation with the same key will be stopped. Defaults to nil.
  • onStart: optional Start callback. Defaults to nil.
  • onComplete: optional Completion callback. Defaults to nil.
  • update: Update callback

Timelines

Use a Timeline to chain Tweens or even other timelines

TimeLine(tweens: [
  1.trx(to: 20) { object.value = $0 },
  30.trx(to: 40) { object.value = $0 },
  40.trx(to: 50) { object.value = $0 },
]).start()

Timeline

Add Tweens with an overlap

let timeline: TimeLine = [
  1.trx(to: 20) { object.value = $0 }: 0,
  30.trx(to: 40) { anOtherObject.value = $0 }: -0.5,
  40.trx(to: 50) { anOtherObject.value = $0 }: -0.5
]
timeline.start()

Timeline with an overlap

Squeeze and stretch Tweens or timelines

let tween = Tween(from: 0,
                  to: 1,
                  time: 0.5) { print($0) }

tween.scale = 2 // duration: 1s
tween.duration = 2.0 // scale: 4

UIView integration

Move to a new position

myView.trxCenter(to: CGPoint(x: 10, y: 15))

Move from a position to the current one

myView.trxCenter(from: CGPoint.zero)

Animate frame to a given CGRect

myView.trxFrame(to: someFrame)

Animate frame from a given CGRect to the current frame

myView.trxFrame(to: someFrame)

Requirements

iOS: 8.4, tvOS: 9.0, Xcode 9, Swift 4.0

For swift 2.3 compatible version check out TRX 4.x

Installation

Cocoa Pods

pod "TRX"

Don't forget to add use_frameworks! to the Podfile. Requires CocoaPods 0.36.x or higher. If you need more help use CocoaPods Guides.

Carthage

Add to your Cartfile:

github "Trxy/TRX"

Swift Package Manager (Experimental)

Specify a dependency in Package.swift

...
.Package(url: "https://github.com/Trxy/TRX.git", majorVersion: 0, minor: 3),
...

Manual

  1. Download or clone the project
  2. Build the preferred target (eg. TRX iOS)
  3. Locate the framework in finder (from the products group) file and add it to your project.
  4. Add the framework as a dependency of your target in Build Phases
  5. Add the framework to “Link Binary with Libraries” and in the “General” tab under “Embedded Binaries”
  6. In order to distribute your app you need to build it for all possible architectures (armv7, armv7s, arm64, x86, etc)

Contributions

Contributions and suggestions are welcome!

If you find any problems using TRX or have any feature requests feel free to create an issue and/or a pull request. In the event of a problem don't forget to add a detailed description, Xcode and target version as well as steps to reproduce.

If you'd like to ask a general question use Stack Overflow with tag trx.swift.

Todos

  • Mac version
  • Custom Bezier Curve easing
  • Short rotation plugin
  • Bezier path plugin

License

MIT

Contributors:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].