v3.6.1 Documentation
Fungus.Parallax Class Reference

Attach this component to a sprite object to apply a simple parallax scrolling effect. More...

Inheritance diagram for Fungus.Parallax:

Protected Member Functions

virtual void Start ()
 
virtual void Update ()
 

Protected Attributes

SpriteRenderer backgroundSprite
 The background sprite which this sprite is layered on top of. More...
 
Vector2 parallaxScale = new Vector2(0.25f, 0f)
 Scale factor for calculating the parallax offset. More...
 
float accelerometerScale = 0.5f
 Scale factor for calculating parallax offset based on device accelerometer tilt angle. More...
 
Vector3 startPosition
 
Vector3 acceleration
 
Vector3 velocity
 

Detailed Description

Attach this component to a sprite object to apply a simple parallax scrolling effect.

The horizontal and vertical parallax offset is calculated based on the distance from the camera to the position of the background sprite. The scale parallax is calculated based on the ratio of the camera size to the size of the background sprite. This gives a 'dolly zoom' effect. Accelerometer based parallax is also applied on devices that support it.

Definition at line 14 of file Parallax.cs.

Member Function Documentation

◆ Start()

virtual void Fungus.Parallax.Start ( )
protectedvirtual

Definition at line 37 of file Parallax.cs.

◆ Update()

virtual void Fungus.Parallax.Update ( )
protectedvirtual

Definition at line 49 of file Parallax.cs.

Member Data Documentation

◆ acceleration

Vector3 Fungus.Parallax.acceleration
protected

Definition at line 34 of file Parallax.cs.

◆ accelerometerScale

float Fungus.Parallax.accelerometerScale = 0.5f
protected

Scale factor for calculating parallax offset based on device accelerometer tilt angle.

Set this to 0 to disable the accelerometer parallax effect.

Definition at line 31 of file Parallax.cs.

◆ backgroundSprite

SpriteRenderer Fungus.Parallax.backgroundSprite
protected

The background sprite which this sprite is layered on top of.

The position of this sprite is used to calculate the parallax offset.

Definition at line 20 of file Parallax.cs.

◆ parallaxScale

Vector2 Fungus.Parallax.parallaxScale = new Vector2(0.25f, 0f)
protected

Scale factor for calculating the parallax offset.

Definition at line 25 of file Parallax.cs.

◆ startPosition

Vector3 Fungus.Parallax.startPosition
protected

Definition at line 33 of file Parallax.cs.

◆ velocity

Vector3 Fungus.Parallax.velocity
protected

Definition at line 35 of file Parallax.cs.


The documentation for this class was generated from the following file: