public static bool add(PTween tween) { if (tween == null) { return(false); } tweens.Add(tween); return(true); }
public static bool removeOne(PTween tween) { if (tween == null) { return(false); } //tweens.Remove(tween); tween.isRemove = true; return(true); }
public static PTween tween(object obj, float duration, PTweenEaseFunc easeFunc, PTweenOnComplete onComplete, params object[] props) { PTweenArgs args = new PTweenArgs(props); float delay = args.getValue <float> ("delay", 0.0f); if (onComplete == null) { onComplete = args.getValue <PTweenOnComplete> ("onComplate", null); } PTween rtw = null; if (args.isExist("from") && args.isExist("to")) { if (args.isType <int>("from")) { rtw = play <int>(obj, args, duration, easeFunc, onComplete, delay); } else if (args.isType <float>("from")) { rtw = play <float>(obj, args, duration, easeFunc, onComplete, delay); } else if (args.isType <Vector2>("from")) { rtw = play <Vector2>(obj, args, duration, easeFunc, onComplete, delay); } else if (args.isType <Vector3>("from")) { rtw = play <Vector3>(obj, args, duration, easeFunc, onComplete, delay); } else if (args.isType <Vector4>("from")) { rtw = play <Vector4>(obj, args, duration, easeFunc, onComplete, delay); } else if (args.isType <Color>("from")) { rtw = play <Color>(obj, args, duration, easeFunc, onComplete, delay); } else if (args.isType <Quaternion>("from")) { rtw = play <Quaternion>(obj, args, duration, easeFunc, onComplete, delay); } else { Debug.LogError("PTween: invalid type:" + args.getType("from")); return(null); } } return(rtw); }
public static bool remove(PTween tween) // remove Group { if (tween == null) { return(false); } for (PTween t = tween.NextTween; t != null; t = t.NextTween) { //tweens.Remove(t); t.isRemove = true; } for (PTween t = tween.PrevTween; t != null; t = t.PrevTween) { //tweens.Remove(t); t.isRemove = true; } //tweens.Remove(tween); tween.isRemove = true; return(true); }
protected override void setup() { size(512 * displayAspectW, 512, P2D); fadeTween = tween(255, 0, 1.0f, PEase.InCubic); tween(this, "col", Color.gray, Color.green, 0.5f, PEase.OutQuad) .to(Color.yellow, 0.5f, PEase.OutQuad) .wait(1.0f) .to(Color.red, 1.0f, PEase.Linear) .reverse() .loop(); wait(3.0f).call(changeBGColor).loop(); pos = new Vector3(width / 2, height / 2, 0.0f); recycle(); noStroke(); }
public static PTween createTween <T>() where T : struct { PTween tween = null; Type t = typeof(T); if (t == typeof(int)) { tween = new IntTween(); } else if (t == typeof(float)) { tween = new FloatTween(); } else if (t == typeof(Vector2)) { tween = new Vector2Tween(); } else if (t == typeof(Vector3)) { tween = new Vector3Tween(); } else if (t == typeof(Vector4)) { tween = new Vector4Tween(); } else if (t == typeof(Color)) { tween = new ColorTween(); } else if (t == typeof(Quaternion)) { tween = new QuaternionTween(); } else { Debug.LogError("PTween createTween: invalid type: " + t); return(null); } add(tween); return(tween); }
protected override void setup() { size(512 * displayAspectW, 512, P2D); fadeTween = tween(255, 0, 1.0f, PEase.InCubic); tween(this, "col", Color.gray, Color.green, 0.5f, PEase.OutQuad) .to(Color.yellow, 0.5f, PEase.OutQuad) .wait(1.0f) .to(Color.red, 1.0f, PEase.Linear) .reverse() .loop(); wait(3.0f).call(changeBGColor).loop(); pos = new Vector3(width / 2, height /2, 0.0f); recycle(); noStroke(); }
void changeBGColor(PTween tween) { bgCol = color(random(100), random(100), random(100)); }
// for iOS (ExecutionEngineException: Attempting to JIT compile method * while running with –aot-only.) static public void unusedCode() { PTween <int> ti = PTweener.tween <int>(null, "hint", default(int), default(int), 1.0f, PEase.Linear) as PTween <int>; PTween <float> tf = PTweener.tween <float>(null, "hint", default(float), default(float), 1.0f, PEase.Linear) as PTween <float>; PTween <Color> tc = PTweener.tween <Color>(null, "hint", default(Color), default(Color), 1.0f, PEase.Linear) as PTween <Color>; PTween <Vector2> tv2 = PTweener.tween <Vector2>(null, "hint", default(Vector2), default(Vector2), 1.0f, PEase.Linear) as PTween <Vector2>; PTween <Vector3> tv3 = PTweener.tween <Vector3>(null, "hint", default(Vector3), default(Vector3), 1.0f, PEase.Linear) as PTween <Vector3>; PTween <Vector4> tv4 = PTweener.tween <Vector4>(null, "hint", default(Vector4), default(Vector4), 1.0f, PEase.Linear) as PTween <Vector4>; PTween <Quaternion> tq = PTweener.tween <Quaternion>(null, "hint", Quaternion.identity, Quaternion.identity, 1.0f, PEase.Linear) as PTween <Quaternion>; ti.tween <int>(null, "hint", default(int), default(int), 1.0f, PEase.Linear); ti.tween <float>(null, "hint", default(float), default(float), 1.0f, PEase.Linear); ti.tween <Color>(null, "hint", default(Color), default(Color), 1.0f, PEase.Linear); ti.tween <Vector2>(null, "hint", default(Vector2), default(Vector2), 1.0f, PEase.Linear); ti.tween <Vector3>(null, "hint", default(Vector3), default(Vector3), 1.0f, PEase.Linear); ti.tween <Vector4>(null, "hint", default(Vector4), default(Vector4), 1.0f, PEase.Linear); ti.tween <Quaternion>(null, "hint", Quaternion.identity, Quaternion.identity, 1.0f, PEase.Linear); tf.tween <int>(null, "hint", default(int), default(int), 1.0f, PEase.Linear); tf.tween <float>(null, "hint", default(float), default(float), 1.0f, PEase.Linear); tf.tween <Color>(null, "hint", default(Color), default(Color), 1.0f, PEase.Linear); tf.tween <Vector2>(null, "hint", default(Vector2), default(Vector2), 1.0f, PEase.Linear); tf.tween <Vector3>(null, "hint", default(Vector3), default(Vector3), 1.0f, PEase.Linear); tf.tween <Vector4>(null, "hint", default(Vector4), default(Vector4), 1.0f, PEase.Linear); tf.tween <Quaternion>(null, "hint", Quaternion.identity, Quaternion.identity, 1.0f, PEase.Linear); tc.tween <int>(null, "hint", default(int), default(int), 1.0f, PEase.Linear); tc.tween <float>(null, "hint", default(float), default(float), 1.0f, PEase.Linear); tc.tween <Color>(null, "hint", default(Color), default(Color), 1.0f, PEase.Linear); tc.tween <Vector2>(null, "hint", default(Vector2), default(Vector2), 1.0f, PEase.Linear); tc.tween <Vector3>(null, "hint", default(Vector3), default(Vector3), 1.0f, PEase.Linear); tc.tween <Vector4>(null, "hint", default(Vector4), default(Vector4), 1.0f, PEase.Linear); tc.tween <Quaternion>(null, "hint", Quaternion.identity, Quaternion.identity, 1.0f, PEase.Linear); tv2.tween <int>(null, "hint", default(int), default(int), 1.0f, PEase.Linear); tv2.tween <float>(null, "hint", default(float), default(float), 1.0f, PEase.Linear); tv2.tween <Color>(null, "hint", default(Color), default(Color), 1.0f, PEase.Linear); tv2.tween <Vector2>(null, "hint", default(Vector2), default(Vector2), 1.0f, PEase.Linear); tv2.tween <Vector3>(null, "hint", default(Vector3), default(Vector3), 1.0f, PEase.Linear); tv2.tween <Vector4>(null, "hint", default(Vector4), default(Vector4), 1.0f, PEase.Linear); tv2.tween <Quaternion>(null, "hint", Quaternion.identity, Quaternion.identity, 1.0f, PEase.Linear); tv3.tween <int>(null, "hint", default(int), default(int), 1.0f, PEase.Linear); tv3.tween <float>(null, "hint", default(float), default(float), 1.0f, PEase.Linear); tv3.tween <Color>(null, "hint", default(Color), default(Color), 1.0f, PEase.Linear); tv3.tween <Vector2>(null, "hint", default(Vector2), default(Vector2), 1.0f, PEase.Linear); tv3.tween <Vector3>(null, "hint", default(Vector3), default(Vector3), 1.0f, PEase.Linear); tv3.tween <Vector4>(null, "hint", default(Vector4), default(Vector4), 1.0f, PEase.Linear); tv3.tween <Quaternion>(null, "hint", Quaternion.identity, Quaternion.identity, 1.0f, PEase.Linear); tv4.tween <float>(null, "hint", default(float), default(float), 1.0f, PEase.Linear); tv4.tween <Color>(null, "hint", default(Color), default(Color), 1.0f, PEase.Linear); tv4.tween <Vector2>(null, "hint", default(Vector2), default(Vector2), 1.0f, PEase.Linear); tv4.tween <Vector3>(null, "hint", default(Vector3), default(Vector3), 1.0f, PEase.Linear); tv4.tween <Vector4>(null, "hint", default(Vector4), default(Vector4), 1.0f, PEase.Linear); tv4.tween <Quaternion>(null, "hint", Quaternion.identity, Quaternion.identity, 1.0f, PEase.Linear); tq.tween <int>(null, "hint", default(int), default(int), 1.0f, PEase.Linear); tq.tween <float>(null, "hint", default(float), default(float), 1.0f, PEase.Linear); tq.tween <Color>(null, "hint", default(Color), default(Color), 1.0f, PEase.Linear); tq.tween <Vector2>(null, "hint", default(Vector2), default(Vector2), 1.0f, PEase.Linear); tq.tween <Vector3>(null, "hint", default(Vector3), default(Vector3), 1.0f, PEase.Linear); tq.tween <Vector4>(null, "hint", default(Vector4), default(Vector4), 1.0f, PEase.Linear); tq.tween <Quaternion>(null, "hint", Quaternion.identity, Quaternion.identity, 1.0f, PEase.Linear); PTweener.clear(); }
public static void removeOneTween(PTween t) { PTweener.removeOne(t); }