Browse Source

Added MoveFrom, RotateFrom & ScaleFrom commands

master
chrisgregan 10 years ago
parent
commit
5ce1137c93
  1. 37
      Assets/Fungus/iTween/Commands/MoveFrom.cs
  2. 8
      Assets/Fungus/iTween/Commands/MoveFrom.cs.meta
  3. 37
      Assets/Fungus/iTween/Commands/RotateFrom.cs
  4. 8
      Assets/Fungus/iTween/Commands/RotateFrom.cs.meta
  5. 35
      Assets/Fungus/iTween/Commands/ScaleFrom.cs
  6. 8
      Assets/Fungus/iTween/Commands/ScaleFrom.cs.meta

37
Assets/Fungus/iTween/Commands/MoveFrom.cs

@ -0,0 +1,37 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[CommandInfo("iTween",
"Move From",
"Moves a game object from a specified position back to its starting position over time. The position can be defined by a transform in another object (using To Transform) or by setting an absolute position (using To Position, if To Transform is set to None).")]
public class MoveFrom : iTweenCommand
{
public Transform fromTransform;
public Vector3 fromPosition;
public bool isLocal;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
if (fromTransform == null)
{
tweenParams.Add("position", fromPosition);
}
else
{
tweenParams.Add("position", fromTransform);
}
tweenParams.Add("time", duration);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("isLocal", isLocal);
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.MoveFrom(target, tweenParams);
}
}
}

8
Assets/Fungus/iTween/Commands/MoveFrom.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d5ca001b90bd14834b7268b48a44c6de
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

37
Assets/Fungus/iTween/Commands/RotateFrom.cs

@ -0,0 +1,37 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[CommandInfo("iTween",
"Rotate From",
"Rotates a game object from the specified angles back to its starting orientation over time.")]
public class RotateFrom : iTweenCommand
{
public Transform fromTransform;
public Vector3 fromRotation;
public bool isLocal;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
if (fromTransform == null)
{
tweenParams.Add("rotation", fromRotation);
}
else
{
tweenParams.Add("rotation", fromTransform);
}
tweenParams.Add("time", duration);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("isLocal", isLocal);
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.RotateFrom(target, tweenParams);
}
}
}

8
Assets/Fungus/iTween/Commands/RotateFrom.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6cfc8560cbecd48adb3950b9dd7f2b82
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

35
Assets/Fungus/iTween/Commands/ScaleFrom.cs

@ -0,0 +1,35 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[CommandInfo("iTween",
"Scale From",
"Changes a game object's scale to the specified value and back to its original scale over time.")]
public class ScaleFrom : iTweenCommand
{
public Transform fromTransform;
public Vector3 fromScale;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
if (fromTransform == null)
{
tweenParams.Add("scale", fromScale);
}
else
{
tweenParams.Add("scale", fromTransform);
}
tweenParams.Add("time", duration);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.ScaleFrom(target, tweenParams);
}
}
}

8
Assets/Fungus/iTween/Commands/ScaleFrom.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0d47cc719ae0d4d62a30b3cfa72b5785
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
Loading…
Cancel
Save