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.
Pages: 1 2 
penner's easing lib (Read 7511 times)
penner's easing lib
Sep 29th, 2007, 4:14am
 
Hi.

Although it appeared in http://processingblogs.org, I thought I'd mention it here. I've packed penner's easing equations as a processing library.

You can download and see a quick and dirty applet example here:

http://www.jesusgollonet.com/blog/2007/09/16/penner-easing-processing-library/

hope they are useful for someone, and of course, feedback is appreciated

best!
Re: penner's easing lib
Reply #1 - Sep 30th, 2007, 11:16pm
 
Hi Jesus,

It's good to see everyone making the fruits of their labor available for scrutiny and use by the general Processing community. This one especially piqued my interest, as I find Penner's easing concepts especially useful in doing anything interactive or animated.

One thing perhaps missing from your implementation (and likely those other Java implementations you mentioned in your blog, though I don't know for sure) is an equivalent to Flash's "Tween" class, which encapsulated the functionality *and* the state of an easing process. With a well-encapsulated object representing the state of a given "tween" or easing motion, you can easily create large amounts of smooth motion -- this is especially important when working on user interfaces, where many separate "tweens" may be happening at any given moment.

As a part of my summer project, I created a partial solution, which turned out to be a barebones implementation of the "Tween" functionality in a Java class. My PhyloWidget program ended up making extensive use of the Tween class, and it's extremely simple to use. A demo of PhyloWidget is available at http://www.andrewberman.org/projects/phylowidget/demo/ . And my latest code for the Tween classes can be found on the Google Code hosting site: http://phylowidget.googlecode.com/svn/trunk/ , then look under src/org/andrewberman/ui/tween .

I'd be very interested in helping put together a comprehensive, stable, and *well-documented* Tween package -- I think it would be a useful thing to have, especially so that others can appreciate and use the simplicity and power of the easing equations combined with the Tween abstraction. Personally, I could never learn to love the usual clunky Java alternatives, such as Chet Haase's Timing Framework (see http://timingframework.dev.java.net/) .

Cheers,
 greg
Re: penner's easing lib
Reply #2 - Oct 1st, 2007, 2:22am
 
Interesting.

I should mention that I've been working on exactly this same topic, and filling in as much documentation as possible as I go.

http://www.megamu.com/processing/shapetween/

This started as a way to help Golan get his shaping functions in an easy to use format, and my own desire to get Flash's Tween object into Processing.

It's still a work in progress, I'm adding more of Golan's shaping functions, and I plan on adding Penner's as well.

I'm interested to hear what you think

Lee
Re: penner's easing lib
Reply #3 - Oct 1st, 2007, 11:34am
 
Hi Lee,

Your library is very much along the lines of what I've been trying to put together -- in fact, it's a shame I didn't think to find out about it *before* rolling my own! I think aside from some small discrepancies in code structure, we have very similar libraries here.

Why not get it all together and start up a real project? With a well-designed basic framework, a thoughtful API, and some JUnit tests, we could make something that works for everyone and can be well maintained by a group as opposed to a single person.

E-mail me if you're interested; I've got most of the next two weeks free to work on something like this.

greg
Re: penner's easing lib
Reply #4 - Oct 3rd, 2007, 3:42am
 
Hi Greg,

I'm glad to hear interest! My library isn't too old, which may be why you hadn't seen it. It started as just a common extraction out of a few projects of mine. Code I noticed I was recreating every time I made a project.

It's still very much in the creation process. I could really run wild with filling in the holes in the programming, but my main focus is keeping the documentation updated alongside the code, to keep myself on that task. Coding is easy, documentation not so much.

I'm curious as to what you think about the API that I have so far, given that it's still very plastic and open to improvements.

I'm not too excited about making it an actively open code base since I think that might make my job of keeping the API on track and the documentation on par with code changes just hellish. But collaboration is always a plus! The most recent source code is always in the library, and if you can think of anything to submit to update things do let me know.

The things I really need at present are examples for the documentation. If you have good yet very short and easy to code examples of some common animation and shaping techniques that would be awesome!

Other things that I have half baked on back burners are arbitrary path following (arc length is messing with me) and brainstorming some EASY way to do animation chaining.

Cool!
Lee
Re: penner's easing lib
Reply #5 - Oct 8th, 2007, 9:31am
 
wow, I can easily see myself becoming a user of both your libs, guys.

my port is just a raw translation of the equations. I haven't used the tweener lib on actionscript. But I'll try it when I'm back there.

@gjuggler, I think I saw your phylowidget some time last summer. nice work.

@megamu the shape functions are great!

best!


Re: penner's easing lib
Reply #6 - Mar 31st, 2008, 5:15pm
 
Would it be possible to have an onFinished event attached to this class?
Re: penner's easing lib
Reply #7 - Apr 1st, 2008, 4:47pm
 
I'd like to do something like this as well, I'm figuring out exactly how that should work. I guess out of curiosity, if you were to write a program using this "onFinished" feature, what would your code look like?
Re: penner's easing lib
Reply #8 - Sep 1st, 2008, 10:44am
 
Old topic but.. I really REALLY like this implementation of Flash's easing:

http://blog.greensock.com/tweenliteas3/

I love how it hijacks into any object you've set, then simply state any object's property to ease. This allows you to animate any object with one line of code...

Example:
Code:

TweenLite.from(clip_mc, 5, {y:"-100", ease:Elastic.easeOut});


I suppose we could write a similar implementation using Java reflection API?
Re: penner's easing lib
Reply #9 - Sep 1st, 2008, 7:35pm
 
The latest version (July 08) of my ShapeTween lib does this, although I've yet to write up the documentation for it!

I rewrote the whole thing from scratch a month or so ago, it's just yet to surface as polished. Thanks for the kick in the butt to go about doing that though!
Re: penner's easing lib
Reply #10 - Feb 23rd, 2009, 3:05am
 
megamu this is a cool little library.  nice to see how clean code is written :-).  i think i found a small bug - function Tween.end() is missing updatePosition().  
Code:

public void end(){
 pause();
 time = inReverse?0:1;
 updatePosition();          // <<< missing this
}

Temp fix: use .seek(1).

Would love to see a way to specify a start time or frame smart enough to know if you suddenly jumped forward in time to what should be the middle of a tween, it would seek() to the correct spot.  i.e. you could pass in your own unit variable, allowing individual timelines that can be start/stopped asynchronously.  

If you have a suggestion for how to approach this in the meantime with your library that would be appreciated.  Let's say there are 2 shapes, each with their own timeline t[n].  What's a clean way to start shape n on some tween at a specific time on its timeline, assuming you need the ability to start, stop, or jump to any time?  If you jump to a time, the tween should adjust but not resume unless timeline is playing.  
Re: penner's easing lib
Reply #11 - Feb 23rd, 2009, 3:11am
 
also a Tween.getDuration() would be useful
Re: penner's easing lib
Reply #12 - Feb 23rd, 2010, 8:03am
 
I don't know if anyone uses this library anymore, but I happened to like the penner easing library. I have to admit I haven't looked into the ShapeTween library, so maybe I should just switch ... but, I found a bug—

It seems that if the Change is greater than the Beginning than the tween doesn't work. Doesn't seem like too big a thing to fix so i'm going to attempt. I'll post progress.


UPDATE

Okay so I think I found the problem when looking at the source. Below is an example with the class Linear for Penner's Easing Library:
Code:

package penner.easing;

public class Linear {

public static float easeNone (float t,float b , float c, float d) {
if(b<c) b = b*(-1); // Just added by jonobrone
return c*t/d + b;
}

public static float easeIn (float t,float b , float c, float d) {
if(b<c) b = b*(-1); // Just added by jonobrone
return c*t/d + b;
}

public static float easeOut (float t,float b , float c, float d) {
if(b<c) b = b*(-1); // Just added by jonobrone
return c*t/d + b;
}

public static float easeInOut (float t,float b , float c, float d) {
if(b<c) b = b*(-1); // Just added by jonobrone
return c*t/d + b;
}

}


I think that this does the trick, but I foolishly went in not really knowing anything about Java Development. I went to the Developer section on the Processing site, but I'm not too familiar with Terminal. I tried creating the directories and subdirectories myself, then archiving it, and renaming the the extension from .zip to .jar...That's not right is it?

When relaunching Processing after replacing the files I get the following error: "The package 'penner' does not exist. You might be missing a library"

Once I figure this part out I'll post the update.
Re: penner's easing lib
Reply #13 - Feb 23rd, 2010, 9:16am
 
look at the new tweening library by Ekene. http://ekeneijeoma.com/processing/tween/ it has the same examples running...
Re: penner's easing lib
Reply #14 - Feb 23rd, 2010, 9:33am
 
Thanks Cedric, I'll use this and drop this older library. Just for curiosity's sake how would I have had to go about packaging that jar?
Pages: 1 2