Java Itween script

With Bob Berkebile’s newest creation the iTween Path editor, he gave a great example tutorial but he only used the C# language. I don’t get along very well with C#. I can write it all day long and still not cognize a single thing about it.

So , does any one have the java script equivalent to the basic iTween path call?

Still not sure what i’m asking? then please go to http://pixelplacement.com/2010/12/03/visual-editor-for-itween-motion-paths/

I’m looking for the java script complement to Bob’s basic C# call as demonstrated in his tutorial.

Thanks :sunglasses:

I looked at his script in that video tutorial.

The one line script.

That as far as I can tell, could be copy/pasted directly into a JavaScript code file and work without any syntax changes.

Did you try it out? What error did you get?

Well, ill give it a try but, that still won’t give me the key java script/ “grammatical calling format” I need to further work with this library. But i’ll check out what you said for bits and wiggles…lol.

I’m sure its not much different than the normal iTween lib. I just need to tweak and fiddle until i figure it out i suppose.

My suggestion would be to spend a day and just go over some very rudimentary C# introduction tutorials. At least get a handle on the basics of C# syntax. Since C# and UnityScript syntax are fairly similar, once you know a little C# you should be able to convert most syntax over. Then for those odd occasions where it does something weird (WTFLUX is public delegate event KeyValuePair<int, bool> OMGWTFBBQ = p => new KeyValuePair<int, bool>(p > 0 ? 1 : Int32.MaxValue, p != null); we’ll be happy to sort it out.

FizixMan is correct. iTween is built so that C#, JavaScript and Boo call it exactly the same way.

So that being the case how would i call an “ITweenPath?”

For example, i can easily call ,synch, sequence and ,segue any iTween event/animation, function, or GUI function by simply saying;
<>

var target :GameObject;
function OnMouseDown () {
iTween.MoveTo(target,{“x”:-631.5,“time”:0.2,“delay”:0.2});

}

-Where the TARGET is called from clicking a “different” game object with the above code attached to it

I get a perfect score every time. (makes me feel pretty cool too, but mostly thankful for this lib.)

So my question is, how would i call an “ITweenPath” on a “TARGET” similar to the above snippet.

In your demonstration you didn’t show how to call an iTweenPath “from another game object.”

I have been toying with your C# basic call, but I can’t get it to “Target” a specific game object after being called from another game object.

I flip through my other C# scripts to get some sort of example and I just don’t have any, as the iTween hash system is very unique(and for good reason).

To sum things up; I was simply wandering if there was a “Java” way of saying,

<>
void Start () {
iTween.MoveTo(gameObject,iTween.Hash(“path”,iTweenPath.GetPath(“BasicPath1”),“time”, 5, “easetype”, iTween.EaseType.easeInOutSine));

}

??
This script works wonderfully as a C# script and when I leave it as a C# script, but when I copy/paste directly into a JavaScript code file
as FizixMan suggested, all I get is “unknown identifier” ,“ItweenPath” from Unity.

Thanks for your ears guys.
~K

Make sure that the iTween.cs file is in your “plugins” folder as per: Unity - Scripting API: and iTween for Unity by Bob Berkebile (pixelplacement)

EDIT: Does “iTweenPath” even exist in the iTween library? Where are you getting that from?

Lol , iTween Path is the “Camera Path Editor” that Mr. Berkebile recently released. Its a very effective and efficient way to create camera motion paths and object motion paths.

Didn’t you see the demo?

Tween.MoveTo(gameObject,iTween.Hash(“path”,iTweenPath.GetPath(“BasicPath1”),“time”, 5, “easetype”, iTween.EaseType.easeInOutSine));

Where ITweenPath is called to run your paths in the hash table.

I would like to see a Java script equivalent.

If I figure it out (which will eventually happen) ,I’ll post it.
~K

Ahh, well I don’t know how UnityPackages work with respect to coding and compilation order.

Fact of the matter is, that code syntax is identical and compatible with JavaScript and C#. The larger issue is how the UnityPackage is being installed and/or referenced.

True that- but, I’m not to in the dark about those types of things ,so I know i have it installed correctly, its just a matter of "Hash Table Language Differences from Java to C#. No worries mate.

That being the case, how do I TARGET a specific gameObject with a C# variable.

I would say public ? ? ();

What would I say?

~K

The same way you would in JavaScript.

GameObject target = GameObject.Find(“someobject”);

What is “public ? ? ();”?

Repeat after me: “C# is not that different from JavaScript. The Unity library usage is mostly* the same in both languages.”

  • there are some minor differences, but I largely chalk that up to UnityScript being a hack. Most likely you’ll never come across these corner cases.

I just figured it out.

I would say:

public GameObject camera1;

// Use this for initialization
void OnMouseDown () {
iTween.MoveTo(camera1,iTween.Hash(“path”,iTweenPath.GetPath(“myPathName”),“time”, 5, “easetype”, iTween.EaseType.easeInOutSine));

}

It works wonderfully.
So if you need to create a camera fly- by at the press of a gui button, attach this script to the button, and there you go.

Thanks for your help.
~K

Glad you were able to figure this out.

Thank you!
~K

I’ve just stumbled upon this post because Im wondering the same thing which no one has answered not even the creator of this awesome Visual Path Editor. But here is shabazzster’s question?

How do I convert this line of C# code to work with JavaScript?

iTween.MoveTo(gameObject, iTween.Hash("path",iTweenPath.GetPath("BoxIn"), "time",5));

It seems that iTweenPath.GetPath(“BoxIn”), is not compatible with javascript because javascript does not know what it is hence Unknown Identifier.

Ok thats what it is The Script iTweenPath.Cs Has to be in the Plugins folder and then it will work

Thank You BOB Your the BEST!!!

I tried that but still go an error. Even when I put the MovePath.cs (the name of my script) into the plugins folder i get an error saying “Assets/Plugins/MovePath.cs(8,63): error CS0103: The name `iTweenPath’ does not exist in the current context” any ideas?

Hi,

I wonder if you can tell me how to start moving along the path from a C# script?

Say using the initialisation line in the tutorial:

iTween.MoveTo(gameObject, iTween.Hash(“path”,iTweenPath.GetPath(“BoxIn”), “time”,5));

Thanks