• Stars
    star
    474
  • Rank 92,640 (Top 2 %)
  • Language
    Swift
  • License
    MIT License
  • Created about 8 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

tvOS controls and extensions that add parallax effect to your application.

PGS Software

ParallaxView

Swift 5.0 CocoaPods Compatible Carthage Compatible SPM Compatible Platform License

Summary

Easy to use UIView, UICollectionViewCell with parallax effect and extensions to add this effect to any UIView. Rotate view using Apple TV remote. Works confusingly similar to tiles in the home screen of the Apple TV.

ParallaxView ParallaxView

ParallaxView

Open your storyboard or xib and drag and drop UIView control. Change custom class to ParallaxView in Identity inspector. You can also create control from code.

ParallaxCollectionViewCell

In Interface builder change collection view cell class to ParallaxCollectionViewCell or do it from code.

You can also create subclass of ParallaxCollectionViewCell insted of UICollectionViewCell and use it as normal collection view cell.

Extension

If ParallaxView and ParallaxCollectionViewCell don't fit to your needs you can use extension that can be used with any UIView. In many cases it can look like in this example:

override func didUpdateFocus(in context: UIFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) {
	coordinator.addCoordinatedAnimations({
		if context.nextFocusedView === yourCustomView {
			yourCustomView.addParallaxMotionEffects()
		}
		if context.previouslyFocusedView === yourCustomView {
			yourCustomView.removeParallaxMotionEffects()
		}
	}, completion: nil)
}

It is important to add and remove parallax effect inside the animation block to avoid the glitches. ParallaxView and ParallaxCollectionViewCell internally use the same methods. For more details look into example.

Customisation

The component is documented in code, also look into example for more details.

Documentation

Properties

ParallaxView and ParallaxCollectionViewCell have the same properties for customisation.

  • parallaxEffectOptions - using this property you can customize parallax effect.

    • parallaxMotionEffect - configure parallax effect (pan, angles, etc.)
    • subviewsParallaxMode - enum that allow you to configure parallax effect for subviews of the ParallaxView
    • shadowPanDeviation - maximal value of points that shadow of the ParallaxView will be moved during parallax effect
    • glowAlpha - configure alpha of the glow effect (if is equal to 0.0 then the glow effect will be not added)
    • parallaxSubviewsContainer - custom container view that will be usead to apply subviews parallax effect. By default it will be parallaxable view by itself.
    • glowContainerView - view that will be used as the container for the glow effect. You don't have to configure this because for ParallaxView it will be automatically created a subview for this purpose, while for ParallaxCollectionViewCell it will be used contentView of the cell. Also by default it is nil when you use extension (self will be used as the glow container but only if glowAlpha is bigger than 0.0). But if you want to, you can define custom view - look into example project for more details.
    • glowImageView - image view that will be used as the glow effect. ParallaxView framework provides default image that will be set.
  • glowPosition - (.top default) - allows to customize position of the glow effect related to the glowImageContainer. You can provide custom setup by creating GlowPosition instance.

  • parallaxViewActions - use properties of this property to change default behaviours of the parallax view. Internally both ParallaxView and ParallaxCollectionViewCell calls callbacks.

    • setupUnfocusedState - closure will be called in animation block when view should change its appearance to the focused state
    • setupFocusedState - closure will be called in animation block when view should change its appearance to the unfocused state
    • beforeBecomeFocusedAnimation - closure will be called before the animation to the focused change start
    • beforeResignFocusAnimation - closure will be called before the animation to the unfocused change start
    • becomeFocused - closure will be called when didFocusChange happened. In most cases default implementation should work
    • resignFocus - closure will be called when didFocusChange happened. In most cases default implementation should work.
    • animatePressIn - default implementation of the press begin animation
    • animatePressOut - default implementation of the press ended animation
  • cornerRadius - use this value insted of self.view.layer.cornerRadius. This will automatically correct radius for glow effect view if it is necessary

Requirements

Swift 5.0, tvOS 9.0

Installation

Add line to Podfile

# ...
target 'MyApp' do
  # your other pod
  # ...
  pod 'ParallaxView'
end
# ...

Add a line to Cartfile:

github "PGSSoft/ParallaxView"

Xcode 12 (Swift 5.3) required!

In Xcode:

Select File > Swift Packages > Add Package Dependency. Enter https://github.com/PGSSoft/ParallaxView

If you would like to check more details please visit the Apple's documentation

  • Manual

You can download the latest files from our Releases page. After doing so, drag ParallaxView.xcodeproj into your project in Xcode, and for your project target on General tab in Embedded Binaries section add ParallaxView.framework. Example project is configured the same way, so you have the crib sheet.

Usage

import ParallaxView

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/PGSSoft/ParallaxView.

License

The project is available as open source under the terms of the MIT License.

About

The project maintained by software development agency PGS Software. See our other open-source projects or contact us to develop your product.

Follow us

Twitter URL
Twitter Follow

More Repositories

1

scrollscreenshot

Make Android screenshots of scrollable screen content
Java
718
star
2

3DSnakeAR

Well known game Snake written in Swift using ARKit.
Swift
478
star
3

AutoMate

Swift framework containing a set of helpful XCTest extensions for writing UI automation tests
Swift
285
star
4

AndroidSDKPoster

Wall poster with detailed changelog of Android SDK versions 14-27, broken down into 30 categories
278
star
5

PuzzleMaker

Swift framework responsible for generating puzzles from the image
Swift
125
star
6

InAppPurchaseButton

A simple and customisable in-app purchase button, written in Swift.
Swift
92
star
7

ramlo

Documentation generator for RAML 1.0
HTML
64
star
8

AutoMate-AppBuddy

iOS UI automation tests helper framework, designed to work with the AutoMate
Swift
30
star
9

gimBUS

Event bus for Android with fine-grained delivery thread control
Java
22
star
10

AutoMate-Templates

Xcode templates helps to start with new UI tests utilizing Page Object pattern and AutoMate framework
Ruby
19
star
11

HttpClientMock

Library for mocking Java 11 HttpClient.
Java
19
star
12

vozilla

R
17
star
13

terraform-provider-mssql

MS SQL Terraform provider
Go
17
star
14

AutoMate-ModelGenie

Generates localized texts for privacy alerts, languages and countries settings for AutoMate framework
Swift
17
star
15

MessagesView

view for displaying messages similarly to messages iOS system app
Swift
16
star
16

GoldenRose

A tool for generating reports from Xcode results bundle
Ruby
16
star
17

ElasticOM

Elasticsearch Object Mapper for PHP 7
PHP
14
star
18

Pgs.CrossPlatform.FormattedText

Cross Platform C# Xamarin Formatted Text Label control enabling to add own tags [b][/b] or similar to HTML tags <b><b><H1></H2> to format text in any size and font
C#
13
star
19

php-docker-skeleton

Dockerized PHP enviroment. This repository is a docker boilerplate for web apps written in PHP.
Shell
12
star
20

HashId

Replace your integer url params in Symfony applications and hide under unpredictable strings.
PHP
12
star
21

XamarinTrackMe-Mobile

Track My Location WHAT: a simple one-click app to share your location: on-line, in a real time, active for 4 hours HOW: generate a link in your mobile app, share info of your current location with anyone you want via: e-mail, sms, Facebook, NFC, Messenger, communicators or any other way. You can stop sharing your location and create a new link any time. WHAT FOR: track your fleet, cargo, partner online, allow customers to track shipments or let your friends find you easily, while at concert or a big party in real time.
C#
12
star
22

PrestigeModel

Gamestate library for Prestige mobile game, similar to card game Splendor
Java
10
star
23

danger-ios_logs

Danger plugin to detect any NSLog/print entries left in the code
Ruby
9
star
24

uglyfier

Gradle script for downsizing Android resources in debug builds
8
star
25

espresso-doppio

Espresso doppio - toys that makes Espresso based ui tests easier
Java
7
star
26

PgsRestfonyBundle

Bundle to assist with creating classes for Doctrine Entity with aim to speed up creating Restful APIs
PHP
6
star
27

pgs-blog

PGS blog extras
HTML
6
star
28

java-spring-course-pwr-2017

Java/Spring course organized on Wrocław Uniwersity of Technology by PGS Software in Spring 2017.
Java
5
star
29

AndroidMvvmTemplates

FreeMarker
5
star
30

TrackMe-Backend

Asp.Net Single Page that display Map user location by its token + SignalR notification for mobile app
JavaScript
4
star
31

ForgetAdapters

An Android library, which (extremely) simplifies seeding lists with data
Java
2
star
32

Nancy.ProblemDetails

Unified error responses for Nancy 1.x (RFC7807)
C#
2
star
33

.net-course-pwr-2017

C#
2
star
34

gulp-recipe-browsersync-server

Receipe for serving files with autoreload
JavaScript
2
star
35

AndroidMVVM

Java
1
star
36

gulp-angular-sample-project

A sample project with gulp-recipe-loader using angular framework.
JavaScript
1
star
37

gulp-sample-project

A sample project using gulp recipes
JavaScript
1
star
38

angular-redux-example

JavaScript
1
star
39

gulp-recipe-loader

Automatic gulp recipe loading and task registration
JavaScript
1
star