Skip to content

Library of scripts for creating the parallax effect on UI elements in Unity.

License

Notifications You must be signed in to change notification settings

RodionLodza/UIParallaxLibary

Repository files navigation

UIParallaxLibary

Library of scripts for creating the parallax effect on UI elements in Unity.

Watch on GitHub Star on GitHub
<< How does it work | How to use | Install | Download >>

What does it look like

0

How does it work

UI elements are usually displayed orthogonally, so it is impossible to create a parallax effect by moving and rotating the camera. However, no one is stopping us from moving and rotating UI objects in such a way as if the camera were moving, not the objects. Such a movement of UI objects gives a very realistic parallax effect.

The library uses an accelerometer, not a gyroscope, because an accelerometer is present on more devices than a gyroscope.

0 0

How to use this library

Firstly, you need to add component of the parallax effect on the scene - the UIParallaxEffect script. It contains a set of UIParallaxLayer objects, which is an array of different UI elements with its parallax settings.

Important! Component UIParallaxEffect initialize and update automatically. If you want control UIParallaxEffect by yourself, than set parametre AutoUpdate to false and call methods Initialize() and RefreshParallaxEffect() in outer scripts.

0

Secondly, you must define each UIParallaxLayer in the UIParallaxEffect component. UIParallaxLayer has several parameters that will be described below.

0

Parameters UIParallaxLayer

  • ParallaxLayerName - layer name (for ease of display)
  • ObjectsRect - array of RectTransform objects that belong to this layer
  • PosXMultiplier - the value at which the X position in the anchoredPosition of the objects changes
  • PosYMultiplier - the value at which the Y position in the anchoredPosition of the objects changes
  • InterpolationSpeed - parallax speed, in other words, the speed at which layer objects move and rotate

How to install?

  1. Download UIParallaxEffect.unitypackage and using UnityPackageManager.
  2. The Unity Package Manager (UPM) is a new method to manage external packages. It keeps package contents separate from your main project files.

Modify your project's Packages/manifest.json file adding this line: "com.lodza.uiparallax": "https://github.com/RodionLodza/UIParallaxLibary.git#package-branch"

To access classes inside of this package you will need to add a reference to com.lodza.fastpool.asmdef to your project's assembly definition file.

License

About

Library of scripts for creating the parallax effect on UI elements in Unity.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages