We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProcessing DevelopmentLibraries,  Tool Development › New animation library w/ timeline/keyframes tweens
Pages: 1 2 3 
New animation library w/ timeline/keyframes tweens (Read 22026 times)
Re: New animation library w/ timeline/keyframes tweens
Reply #15 - Mar 18th, 2010, 11:35am
 
ok so its a scope problem then. those tween events are for tweens that are inside of the RadialDiagramTest not the RadialDiagram class. what you can do though is use tween.addEventListener(MotionEventListener listener) to add RadialDiagram as a listener. to do this RadialDiagramTest also has to implement MotionEventListener and must have the method  onMotionEvent(MotionEvent te) inside of it. then within that method you can use te.type to see what type of event happened for example by using

Code:

void public onMotionEvent(MotionEvent te) {
if(te.type == MotionEvent.TWEEN_STARTED) {
//do something
}
}


i have some examples im uploading this weekend so let me know if you have more problems...
Re: New animation library w/ timeline/keyframes tweens
Reply #16 - Mar 20th, 2010, 11:40am
 
Thank you, that's working!

And leading me to the next question Smiley
Is there a reference in this MotionEvent to the Tween? My plan is to create a tween, add it to a vector (list), reading the position till it's finished and then remove the tween from the vector and "delete" it by setting it to null. Do you see a way to do this?
Re: New animation library w/ timeline/keyframes tweens
Reply #17 - Mar 20th, 2010, 3:05pm
 
why do you want to add the tweens to a vector/list then remove them when the tween has ended? are you updating the tweens in a draw/update method? if so you should be because they update themselves using processing's pre method which is called every time draw is called. anyhow here is an example

Code:

import ijeoma.motion.event.MotionEvent;
import ijeoma.motion.event.MotionEventListener;
import ijeoma.motion.tween.Tween;
import ijeoma.motion.tween.TweenGroup;

TweenGroup tweenGroup;

void setup() {
 size(400, 200);

 ellipseMode(CORNER);
 smooth();

 CustomMotionEventListener cmel = new CustomMotionEventListener();

 // tweenGroup = new TweenGroup(this, "tweenGroup1", new Tween[] { new
 // Tween(this, "tween1", 0, width, random(50, 100)), new Tween(this,
 // "tween2", 0, width, random(100, 150)) });

 Tween t1 = new Tween(this, "tween1", 0, width, random(50, 100));
 t1.addEventListener(cmel);

 Tween t2 = new Tween(this, "tween2", 0, width, random(100, 150));
 t2.addEventListener(cmel);

 tweenGroup = new TweenGroup(this, "tweenGroup1", new Tween[] {
   t1, t2   }
 );
 
 // tweenGroup.addEventListener(cmel);
 tweenGroup.play();
}

void draw() {
 background(255);

 noStroke();

 fill(100);
 rect(0, 0, tweenGroup.getTween("tween1").getPosition(), height / 2);

 fill(200);
 rect(0, height / 2, tweenGroup.getTween("tween2").getPosition(), height / 2);
}

public void keyPressed() {
 tweenGroup.play();
}

class CustomMotionEventListener implements MotionEventListener {
 public void onMotionEvent(MotionEvent me) {
   if (me.type.equals(MotionEvent.TWEEN_ENDED))
     PApplet.println(me.getSource());
 }
}


after doing this i found some event related bugs in the library but theyre unrelated to what youre doing... but if you were to add some tweens to a tweengroup then add a custom listener to tweengroup the tweengroup events would be called and not the tween events... but i fixed that and itll be in the next release. so for now you have to add each event listener to each tween seperately.

Re: New animation library w/ timeline/keyframes tweens
Reply #18 - Mar 21st, 2010, 6:31pm
 
Hi,

as a Flash guy using Proc, I am loving this library. Thanks!

I'm seeing 2 issues with v0.1.1: Delay is not working and repeat.REVERSE is not working. Example code below.

Code:
import ijeoma.motion.tween.*;
import ijeoma.motion.easing.*;
Tween tween1;
Tween tween2;
TweenGroup tweenGroup;

void setup() {
size(400, 450, P3D);

tween1 = new Tween(this, "Tween1", 0, 390, 100, Tween.FRAMES, 0, Tween.LINEAR_EASE_IN);
//tween with delay starts at same time?
tween2 = new Tween(this, "Tween1", 0, 390, 100, Tween.FRAMES, 200, Tween.LINEAR_EASE_IN);

tweenGroup = new TweenGroup(this, new Tween[]{
tween1,tween2}
);

//REVERSE and NO_REVERSE both loop without reversing?
//tweenGroup.repeat(Tween.NO_REVERSE);
tweenGroup.repeat(Tween.REVERSE);

tweenGroup.play();
}

void draw() {
background(0);
fill(140, 255, 100);
rect(tween1.getPosition(), 10, 10, 10);
rect(tween2.getPosition(), 20, 10, 10);
}
Re: New animation library w/ timeline/keyframes tweens
Reply #19 - Mar 22nd, 2010, 10:28am
 
Now you can tween multiple variables/parameters using a single tween object!

I added a class called MotionParameter to Motionlib which can be used with in the Tween class to tween multiple parameters using a single tween! And can also use either variable names (which can either be in object or outside of an object) or "tween name" as parameters!

for example before tween multiple variables/values together, say x, y and z, you would have to make 3 separate tween objects and add them to a TweenG

roup object. so you'd have to do

Code:

Tween x = new Tween(this, "x", 0, width, 100);
Tween y = new Tween(this, "y", 0, width, 100);
Tween z = new Tween(this, "z", 0, width, 100);

TweenGroup xyz = new TweenGroup(this, new Tween[]{x, y, z});
xyz.play();


then to get the tween positions for x, y, and z you'd have to do

Code:

xyz.getTween("x").getPosition();
xyz.getTween("y").getPosition();
xyz.getTween("z").getPosition();


or

Code:

x.getPosition();
y.getPosition();
z.getPosition();


depending on the scope of the x, y and z Tween objects.

but now using TweenParameter objects to tween using VALUES (w/o pre-defined variables) you can do
Code:

xyz = new Tween(this, "xyz");

xyz.addParameter(new MotionParameter("x", 0, 100));
xyz.addParameter(new MotionParameter("y", 0, 100));
xyz.addParameter(new MotionParameter("z", 0, 100));

xyz.setDuration(100);
xyz.play();


or

Code:

xyz = new Tween("xyz", "x:100, y:100, z:100", 100);
xyz.play()


or to tween using VARIABLES you can either do

Code:

float x, y, z;

x = y = z = 0;

xyz = new Tween(this, "xyz", "x:100, y:100, z:100", 100);
xyz.play()


or

Code:

float x, y, z;

x = y = z = 0;

xyz.addParameter(new MotionParameter(this, "x", 0, 100));
xyz.addParameter(new MotionParameter(this, "y", 0, 100));
xyz.addParameter(new MotionParameter(this, "z", 0, 100));

xyz.setDuration(100);
xyz.play();


then to get each tween position inside xyz write

Code:

t.getPosition("x");
t.getPosition("y");
t.getPosition("z");


or you can write

Code:

translate(x,y,z);


NOTE: "this" can be replaced by the any custom objects you make so you can tween variables with in custom objects too!

Also i know the addParameter is doing much more than the "variablename:value" way you can do much more using them. Too see more you can look at the different constructors for the Tween and MotionParameter class.

Also I fixed the delay and reverse bugs were fixed too!

The two newest examples Tween_Parameter_Test and TweenSequence_3DPath_Complex show how TweenParameters can be used.

I couldn't export all the examples so you'll have to run them yourself until i can resolve some GStreamer problems on OSX Leopard which are causing Processing IDE throw errors at runtime...

You can download the new release at
http://ekeneijeoma.com/processing/motionlib/

Let me know your thoughts!
Re: New animation library w/ timeline/keyframes tweens
Reply #20 - Mar 25th, 2010, 4:29am
 
Hi,

it seems like there is still a little bug inside the delay. If I add a lot of tweens, the delay is behaving strangly.

little code snippet:
Code:
while (j.hasNext()){
ii++;
Map.Entry<String, DiagramBalken> iN = j.next();
Tween tTween = new Tween(app, "tween_"+ii, 0, iN.getValue().getSize(), tweenDuration,Tween.SECONDS, ii*0.2f,Tween.BOUNCE_EASE_OUT);
tTween.addEventListener(this);
tweenElements.add(new BalkenTween(tTween,iN.getValue()));
}


And big thanks for this library!
Re: New animation library w/ timeline/keyframes tweens
Reply #21 - Mar 26th, 2010, 12:16pm
 
*MORE CHANGES AND BUG FIXES*

First, in the last release I removed "Event" from the basic events methods. So, for example tweenStartedEvent(Tween _t) is now tweenStarted(Tween _t) and etc.

Also there in the last release there were more problems with delay which have been fixed. I added two "delay modes" ONCE and EVERY (which is the default) which are to be used when a "motion object" is repeating. ONCE will not do another delay after the first play and EVERY will do a delay after every play. I also added a new motion object constructor:

Tween(PApplet _parent, java.lang.String _name, float _begin, float _end, float _duration, float _delay);

so you don't have to use

Tween(PApplet _parent, java.lang.String _name, float _begin, float _end, float _duration, String _durationMode, float _delay);

if you want to define a delay without defining the durationMode at which the default MotionConstant.FRAMES would be used. So anyhow now you can either do

Code:
 
t = new Tween(this, "tweens", 0f, width, 100f, 100f);
t.setDelayMode(MotionConstant.ONCE);
t.repeat();


or

Code:
 
t = new Tween(this, "tweens", 0f, width, 100f, 100f);
t.setDelayMode(MotionConstant.EVERY);
t.repeat();


You can also see these new delay modes used in these examples:
http://ekeneijeoma.com/processing/motionlib/examples/TweenGroup_Delay/applet/ind...
http://ekeneijeoma.com/processing/motionlib/examples/Tween_Delay/applet/index.ht...

Also I made changes in these examples to use the TweenParamter both in Tween constructors or using the addParameter methods:

http://ekeneijeoma.com/processing/motionlib/examples/Tween_Parameter/applet/inde...
http://ekeneijeoma.com/processing/motionlib/examples/Tween_Object_Parameter/appl...

And lastly I added a new example for using advance events with custom motion object event listeners:

http://ekeneijeoma.com/processing/motionlib/examples/TweenGroup_EventListener/ap...
Re: New animation library w/ timeline/keyframes tweens
Reply #22 - Mar 26th, 2010, 12:19pm
 
@csteinlehner Thanks for the bug reports but could you post code that I can copy, paste and run otherwise its more difficult for me to find the bugs you've found... That code is half german and half english... How is it that your using new BalkenTween and not TweenGroup? Are you using a german preprocessor or something? Anyhow, I think the problems you were having were fixed with this new release so let me know if you find more bugs.
Re: New animation library w/ timeline/keyframes tweens
Reply #23 - Mar 29th, 2010, 1:00pm
 
Fixed more bugs with the repeat() and repeat(String repeatMode) methods... but there's still some bugs in both TweenSequence and Timeline repeat(MotionConstant.REVERSE) methods, which i may fix this week. Go to the website to download it.

I also updated these examples:
http://ekeneijeoma.com/processing/motionlib/examples/TweenGroup_Delay/applet/ind...
http://ekeneijeoma.com/processing/motionlib/examples/TweenSequence_Seek/applet/i...
http://ekeneijeoma.com/processing/motionlib/examples/Timeline_Seek/applet/index....
Re: New animation library w/ timeline/keyframes tweens
Reply #24 - Mar 31st, 2010, 10:26am
 
Thanks! The bug is fixed now. Sorry for the german code snips. I'm german and so sometimes there're sneaking german words and classnames into my code Wink
Re: New animation library w/ timeline/keyframes tweens
Reply #25 - Apr 6th, 2010, 3:04pm
 
NEW RELEASE! NOW YOU CAN ADD CALLBACKS (METHOD/FUNCTION CALLS) TO TIMELINES AND TWEENSEQUENCES!

There are 4 new Timeline/TweenSequence methods to add callbacks.

These two can be used to call methods within your PApplet object.

Code:
addCallback(java.lang.String _callbackObjectMethodName, float _time)
addCallback(java.lang.String _callbackObjectMethodName, float _time, float _duration)


And these two can be used to call methods in any object.

Code:
addCallback(java.lang.Object _callbackObject, 
java.lang.String _callbackObjectMethodName, float _time)
addCallback(java.lang.Object _callbackObject, java.lang.String _callbackObjectMethodName, float _time, float _duration)


Too see an example look at http://ekeneijeoma.com/processing/motionlib/examples/Timeline_Callback/applet/in....

Soon youll be able to add callback to every motion controller/manager…

So with the new MotionCallback object which is hidden, now the motion objects are:

Tween, TweenGroup, TweenSequence, Timeline, TimelineKeyframe, or MotionCallback (may be renamed "Callback").

and the motion controllers/managers are:

TweenGroup, TweenSequence, Timeline, TimelineKeyframe

Also the methods addTween and addTweenGroup are deprecated. Now to add a "motion object"  to a "motion controller" you can use addChild to add whichever motion objects you want. For example

Code:
TweenGroup tg = new TweenGroup(this);
tg.addChild(new Tween(…));
tg.addChild(new TweenGroup(…));
tg.addChild(new TweenSequence(…));


And also too add multiple children you can use addChildren. For example

Code:
TweenGroup tg = new TweenGroup(this);
tg.addChildren(new Motion[] {new Tween(…), new TweenGroup(…), new TweenSequence(…));


As you can add multiple Tweens, TweenGroups and TweenSequences and also put them in the same  array parameter.
Re: New animation library w/ timeline/keyframes tweens
Reply #26 - Apr 13th, 2010, 1:57pm
 
First off, thanks for a great lib! As a Flash developer this makes my Processing work much easier.

I only have one issue/question, how do I disable the position debugging? Using a couple of TweenPath3D and the "position = 0.9955356" kind of logs drowns my other logs. I've gone trough the reference and tried the disable method for logger, but no go.

Thanks!
Re: New animation library w/ timeline/keyframes tweens
Reply #27 - Apr 14th, 2010, 12:40pm
 
Thanks for seeing that balonka! I was using those printlns calls to debug an error thrown after the first play and before the first repeat when calling repeat(TweenPath3D.REVERSE). Anyhow in this new version I fixed those errors and removed those println calls. Also good to know that its made using Processing much easier! Could you post your project when youre through or email it to me so i can see how youre using it? Also let me know if you have some requests too. Download the version 3.0.1 and see if you have anymore problems.
Re: New animation library w/ timeline/keyframes tweens
Reply #28 - Apr 15th, 2010, 4:19pm
 
Cheesy wow! Thanx for the Lib! i love it!

Just one Ques. "Could you please show an example how to use the PhysicsTween.. "
thanx alot!

* native77
Re: New animation library w/ timeline/keyframes tweens
Reply #29 - Apr 17th, 2010, 9:48pm
 
Released 3.0.2 which fixes MotionParameter problems.

And Thanks Native77 good to know! I haven't had time to fix PhysicsTween the problems I was having with it so for now it can't be used.
Pages: 1 2 3