// Copyright (c) 2011-2017 Thinksquirrel Inc.

using UnityEngine;
using Thinksquirrel.Thinkscroller;

/// <summary>
/// Example script - scrolls based on the object's transform.
/// </summary>
[AddComponentMenu("Thinkscroller Example/Scroll With Transform")]
public class ScrollWithTransform : MonoBehaviour
{
    private Transform myTransform;
    private Vector3 oldPosition;
    private Vector3 scrollVector;

    private void Start()
    {
        myTransform = transform;
    }

    private void Update()
    {
        scrollVector = myTransform.position - oldPosition;
        Parallax.Scroll(scrollVector.x, scrollVector.y);
        oldPosition = myTransform.position;
    }
}
