Simple, extensible interpolation framework

Related tags

Animation Popsicle
Overview

THIS PROJECT IS NO LONGER MAINTAINED.


Popsicle header

Carthage compatible CocoaPods compatible

GIF 1

Popsicle is a Swift framework for creating and managing interpolations of different value types with built-in UIKit support.

Installation

Carthage

github "DavdRoman/Popsicle"

CocoaPods

pod 'Popsicle'

Manual

Drag and copy all files in the Popsicle folder into your project.

At a glance

Interpolating UIView (or any other NSObject) values

First, you need an Interpolator instance:

let interpolator = Interpolator()

Next, you need to add some Interpolation<T> instances to your interpolator. In the example below, we are going to interpolate the alpha value of a UIView for times between 0 and 150:

let interpolation = Interpolation(yourView, alpha)
interpolation[0] = 0
interpolation[150] = 1
self.interpolator.addInterpolation(interpolation)

Note alpha is a built-in KeyPath<T, U> constant. Popsicle offers a nice set of UIKit-related KeyPaths ready to be used. You may also use a completely custom key path.

You can also modify the easing function used at a given time:

interpolation.setEasingFunction(EasingFunctionEaseOutQuad, forTime: 0)

There's a bunch of built-in easing functions to choose from.

Finally, just make your interpolator vary its time depending on whatever you want. For example, the content offset of a UITableView:

func scrollViewDidScroll(scrollView: UIScrollView) {
	interpolator.time = Double(scrollView.contentOffset.y)
}

Interpolating custom values

You can declare a value type as interpolable by making it conform to the Interpolable protocol.

As an example, check out how CGPoint conforms to Interpolable:

extension CGSize: Interpolable {
	public static func interpolate(from fromValue: CGSize, to toValue: CGSize, withProgress progress: Progress) -> CGSize {
		let width = CGFloat.interpolate(from: fromValue.width, to: toValue.width, withProgress: progress)
		let height = CGFloat.interpolate(from: fromValue.height, to: toValue.height, withProgress: progress)

		return CGSizeMake(width, height)
	}

	public static func objectify(value: CGSize) -> AnyObject {
		return NSValue(CGSize: value)
	}
}

License

Popsicle is available under the MIT license.

Comments
  • DRDynamicSlideShow gone?

    DRDynamicSlideShow gone?

    Hey there, I'm new to IOS so please forgive this likely very noob question.

    I have an IOS project that was using DRDynamicSlideShow. When I go now to pod update I get an error saying:

    warning: Could not find remote branch 1.0.1 to clone. fatal: Remote branch 1.0.1 not found in upstream origin

    All links to that Pod took me to the Popsicle repo. So I tried adding Popsicle to the project instead but that doesn't work.

    Once again sorry for noob question.

    opened by djclarkson 10
  • widthConstraint and heightConstraint cause a crash

    widthConstraint and heightConstraint cause a crash

    if you change line 54 of the demo project, the app with crash with

    "fatal error: Please make sure the key path "NSLayoutAttribute.Width" you're referring to for an object of type is invalid: file /var/folders/hj/yvctlzcs65n1rlgrnvq712_h0000gn/T/CocoaPods/Try/Popsicle/Popsicle/Interpolation.swift, line 33 "

    I looked in the storyboard are there are constraints for width and height. Am I doing something incorrect?

    opened by Rich86man 6
  • working with a button across multiple views

    working with a button across multiple views

    hey,

    I have a button that I anchor to a corner on the first page, and it stays static across 3 separate page views. The button gets anchored fantastically, however it removes itself as a target in the second and third pages. Any idea as to how I can keep it as a functional button?

    Thanks!

    opened by hsavit1 5
  • Remove old pod from cocoapods

    Remove old pod from cocoapods

    Hi,

    We want to replace it with our fork, since you dropped iOS 7 support, renamed repo and force pushed all the code. Don't do that again.

    https://cocoapods.org/pods/DRDynamicSlideShow

    opened by AndrewDryga 3
  • Performances : if having 50 subviews or 50 images

    Performances : if having 50 subviews or 50 images

    From setupSlideShowSubviewsAndAnimations in example, it will add all of them under one view. Will it perform well? or 50 images as slideshow..

    or basically how to reuse existing subview with different images and different animation transform

    enhancement 
    opened by steve21124 3
  • TouchView

    TouchView

    I create a simple interpolation between 2 views, but in the first view i have one Button, i need this button can be touched in second view.

    I try to set secondView userInteractionEnabled, but have no effect, any idea?

    Thank you

    opened by ferbass 2
  • Cocoapods issue

    Cocoapods issue

    When I install DRDynamicSlideShow via pod,I have to import them like #import ,but the animation doesn't works,when I remove DRDynamicSlideShow from Podfile and reinstall,and then manually add 2 files into project ,import them like "DRDynamicSlideShow",the animation works! I can't figure out why...

    opened by lumiasaki 2
  • The future of DRDynamicSlideShow

    The future of DRDynamicSlideShow

    After thinking about this library for a while, I've come to a decision: decoupling the keyframing/interpolation logic from the view logic, leading to 2 different projects.

    For the last few months, I've been working on a value interpolation framework called Popsicle, highly inspired by both Facebook's pop and IFTTT's JazzHands, providing the best of both frameworks, such as custom value interpolation and UIKit agnosticism.

    The view logic will lie on DRPageScrollView, a library I just released. This way, you can use DRPageScrollView as a single paginated scroll view, or combine it with the future Popsicle framework in order to get some fancy animated transitions. Needless to say that Popsicle is completely independent from DRPageScrollView as well.

    Popsicle will be released really soon, so stay tuned :)

    opened by davdroman 1
  • Use as Intro.

    Use as Intro.

    Hi I tried to use DRDynamicSlideShow like this -viewdidLoad //My MainVC { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]]; _introView = [storyboard instantiateViewControllerWithIdentifier:@"intro"]; // @"intro" is MainViewController in this demo code.
    [self presentViewController:_introView animated:NO completion:nil]; } but the result is blank Content, how is the correct usage , when use as Intro, Thanks.

    and also I plan to dismiss intro viewcontroller by this. -(void)finishIntroToMainView { [self dismissViewControllerAnimated:true completion:nil]; }

    opened by futomtom 1
  • Demo Project Update

    Demo Project Update

    I've updated the demo project to make it a little cleaner and easier to understand. Here's what this pull request changes:

    • Changed code to support storyboard initialization
      • Move away from XIBs
    • Clean-up some project settings, images (moved everything to XCAssets), and code
    • Updated Readme by adding more information, descriptive, text, etc.

    This is just a little update. You may like it... or not. Great project by the way - I will be using it in the next update of my app: Runr (http://AppStore.com/Runr). Let me know what you think.

    enhancement 
    opened by Sam-Spencer 1
  • Added support for using DRDynamicSlideShow in IB

    Added support for using DRDynamicSlideShow in IB

    Added initWithFrame:and initWithCoder:, and moved code from init to a common configure method. This allows for using DRDynamicSlideShow directly in IB by adding a UIScrollView and setting the class to DRDynamicSlideShow.

    enhancement 
    opened by thomassnielsen 1
Releases(3.0.0-alpha.1)
Owner
David Roman
David Roman
Designed for gesture-driven animations. Fast, simple, & extensible!

Yet Another Animation Library Designed for gesture-driven animations. Fast, simple, & extensible! It is written in pure swift 3.1 with protocol orient

Luke Zhao 509 Dec 21, 2022
An extensible iOS and OS X animation library, useful for physics-based interactions.

Pop is an extensible animation engine for iOS, tvOS, and OS X. In addition to basic static animations, it supports spring and decay dynamic animations

Meta Archive 19.8k Dec 28, 2022
DaisyChain is a micro framework which makes UIView animations chaining dead simple.

DaisyChain DaisyChain is a micro framework which makes UIView animations chaining dead simple. It uses the exact same interface you are familiars with

Ali Karagoz 31 Nov 3, 2022
Gemini is rich scroll based animation framework for iOS, written in Swift.

Overview What is the Gemini? Gemini is rich scroll based animation framework for iOS, written in Swift. You can easily use GeminiCollectionView, which

Shohei Yokoyama 3k Dec 27, 2022
Testing the new ShazamKit framework announced at WWDC 2021

ShazamKit Demo Using the ShazamKit framework announced at WWDC 2021 to perform song recognition. Demo Tweet Usage Open the project and change the Bund

Sai Kambampati 18 Mar 17, 2022
Facebook's Pop Framework, By Examples

Facebook's Pop Framework, By Examples --- This project is a tutorial (Check tutorial here) for how to use Pop framework by Facebook. Its very easy and

Hossam Ghareeb 183 Aug 1, 2022
WWDC 2019'da tanıtılan yeni UI framework'ü SwiftUI'ya giriş amacı gütmektedir.

SwiftUI-Presentation Burada SwiftUI'yı Türkçe bir şekilde sunmak istiyorum. Playground'u açtıktan sonra Editor -> Show Rendered Markup seçeneği ile bi

Barış Uyar 2 Apr 28, 2022
A micro-framework that leverages Swift Property Wrappers to implement the Service Locator pattern

Locatable Context Locatable is a Swift micro framework that leverages Property Wrappers to implement the Service Locator pattern, through a custom att

Vincent Pradeilles 116 Jan 9, 2022
Design-system-demo - This example code is bare-bones to show you what this framework can do

Basic Style Dictionary This example code is bare-bones to show you what this fra

Tylen St Hilaire 0 Feb 3, 2022
A framework and generator for displaying SwiftUI component libraries

Exhibition Exhibition is a framework and generator for displaying a SwiftUI component library. Inspired by Storybook and Showkase Installation Swift P

Malcolm Jarvis 23 Dec 30, 2022
Publish–subscribe design pattern implementation framework, with an ability to publish events by topic.

TopicEventBus Publish–subscribe design pattern implementation framework, with ability to publish events by topic. (NotificationCenter extended alterna

Matan Abravanel 55 Nov 29, 2021
Framework to help you better manage UITableViews

UITableView made simple ?? Main Features ?? Skip the UITableViewDataSource & UITableViewDelegate boilerplate and get right to building your UITableVie

null 84 Feb 4, 2022
SYBlinkAnimationKit is a blink effect animation framework for iOS, written in Swift.

SYBlinkAnimationKit is a blink effect animation framework for iOS, written in Swift ?? Demo There are 5 types of animation for component. border borde

Shohei Yokoyama 126 Oct 28, 2021
iOS framework for impressive transition animations between views.

CoreTransition iOS framework for impressive transition animations between views. Built using Swift, and supports a lot of animations to navigate to a

Ahmed Abdelkarim 4 Nov 17, 2022
Advanced Natural Motion Animations, Simple Blocks Based Syntax

FlightAnimator Moved to Swift 3.1 Support: For Swift 3.1 - Use tag Version 0.9.9 See Installation Instructions for clarification Introduction FlightAn

Anton 589 Dec 29, 2022
Simple Interface Core Animation. Run type-safe animation sequencially or parallelly

Simple Interface Core Animation Sica can execute various animations sequentially or parallelly. Features Animation with duration and delay parallel /

CATS Open Source Softwares 1k Nov 10, 2022
A simple animated progress bar in Swift

DSGradientProgressView Introduction DSGradientProgressView is a simple and customizable animated progress bar written in Swift. Inspired by GradientPr

Dhol Studio 445 Oct 13, 2022
Simple and powerful animated progress bar with dots

Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements iOS 8.0+ Swift 3.0+ Installatio

Nikola Corlija 42 Dec 5, 2022
Simple Animated tabbar with native control

SSCustomTabbar Simple Animated tabbar with native control. Requirements iOS 11.0+ Xcode 10.0+ Installation SSCustomTabbar doesn't contain any external

Simform Solutions 452 Dec 13, 2022