ProductPromotion
Logo

Swift

made by https://0x3d.site

GitHub - scihant/CTPanoramaView: A library that displays spherical or cylindrical panoramas with touch or motion based controls.
A library that displays spherical or cylindrical panoramas with touch or motion based controls. - scihant/CTPanoramaView
Visit Site

GitHub - scihant/CTPanoramaView: A library that displays spherical or cylindrical panoramas with touch or motion based controls.

GitHub - scihant/CTPanoramaView: A library that displays spherical or cylindrical panoramas with touch or motion based controls.

CTPanoramaView

CI Status SwiftPM Compatible Cocoapods Compatible Issues

CTPanoramaView is a high-performance library that uses SceneKit to display complete spherical or cylindrical panoramas with touch or motion based controls.

panorama_demo

Requirements

  • iOS 13.0+
  • Swift 5.0

CTPanoramaView can be used both from Objective-C and Swift code.

Installation

Using Swift Package Manager

  1. In Xcode, select “File” → “Add Packages...”
  2. Enter https://github.com/scihant/CTPanoramaView.git

Using CocoaPods

To install CTPanoramaView using CocoaPods, add the following line into your Podfile:

pod "CTPanoramaView", "~> 1.6"

Then run the pod install command and use the created workspace to open your project from now on.

Manual Install

Just add the file CTPanoramaView.swift (and CTPieSliceView.swift if you want to use it as the compass view) to your project.

Running the Example project

The example project is located in the Example directory. The framework target is already added as a dependency to it therefore you can run it directly.

Usage

Create an instance of CTPanoramaView either in code or using a Storyboard/Nib.

Then load a panoramic image and set it as the image of the CTPanoramaView instance:

// Create an instance of CTPanoramaView called "panoramaView" somewhere
// ...
let image = UIImage(named: "panoramicImage.png")
panaromaView.image = image

panorama_screenshot

Configuration

Panorama Types

CTPanoramaView supports two types of panoramic images:

  • Spherical panoramas (also called 360 photos)
  • Cylindrical panoramas

All panoramas should be full. Partial panoramas (panoramas with a field of view of less than 360º) are not supported. For a spherical panorama, the image should use equirectangular projection. Cubic format is not supported.

CTPanoramaView will automatically determine whether the given image is a spherical or cylindircal panorama by looking at the aspect ratio of the image. If it is 2:1, then it will assume a spherical panorama. If you want to override this default value, change the value of the panoramaType property after the image is set.

panaromaView.panoramaType = .spherical  // or .cylindrical

Control Methods

CTPanoramaView allows the user to navigate the panorama two different ways. To change the control method, use the controlMethod property.

panaromaView.controlMethod = .touch  // Touch based control
panaromaView.controlMethod = .motion // Accelerometer & gyroscope based control
panaromaView.controlMethod = .both // Accelerometer & gyroscope based control with finger movement support

The default control method is touch based control. You can change the control method on the fly, while the panorama is being displayed on the screen. The visible section will get automatically reset during a control method change.

When using touch based control, you can set the starting angle of the viewer in radians using the startAngle property of CTPanoramaView. This property is ignored in motion based control mode.

Orientation Support

All orientations are supported. Orientation changes are automatically handled. Therefore you don't have to worry about things getting messed up after an orientation change.

Compass

If you want to display a compass that shows the users current field of view, use the compass property. When you set this property to a custom UIView subclass conforming to the CTPanoramaCompass protocol, the view will automatically supplied with rotation and field of view angles whenever one of them changes.

// compassView is a custom view that conforms to the `CTPanoramaCompass` protocol.
panaromaView.compass =  compassView

The protocol contains only a single method, which is updateUI(rotationAngle:fieldOfViewAngle:). Here, rotationAngle is the amount of rotation around the vertical axis, and fieldOfViewAngle is the horizontal FoV angle of the camera. Both values are in radians.

You can see an example implementation of a compass in the supplied CTPieSliceView class. Add it into your view hierarchy somewhere above your CTPanoramaView instance, and then set it as its compass. You'll see that it shows the current FoV accurately. Here's how CTPieSliceView looks in its default configuration:

compassview

CTPieSliceView has several customizable properties such as sliceColor, outerRingColor and bgColor, all of which can also be modified from the interface builder thanks to its live-rendering support.

Overlay Views

There is also a convenience property named overlayView that can be used to add a custom view that covers the entire panorama view on top. When using touch based controls, it's up to you to make sure that the overlay view does not "consume" the touches it receives so that the CTPanoramaView instance can receive the touch events properly.

How to Contribute

Create a feature branch off the dev branch and then send me a pull request. I don't merge PR's directly to master so please don't make your changes there.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory