Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Penner Tweening Help


Hi all,

Need your help with a simple position+scale tween of an image.

I've got a picture that need to move and scale at the same time. I did it with the "mx.transitions". But the movement has a weird "flick", a "not smooth" transition.

I've read that Robert Penner can help with this, but I don't know how to do it.

Please see the attached sample and tell me if there is a Penner solution or maybe any other
class of tweening that helps this picture to move smoothly.

Thanks in advance!




KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 01-13-2008, 09:12 PM


View Complete Forum Thread with Replies

Sponsored Links:

Robert Penner & Tweening Equations
What a wonderfull file that Robert Penner offert to us but I really dont understand where I can put those codes...
example:

// simple linear tweening - no easing
// t: current time, b: beginning value, c: change in value, d: duration
Math.linearTween = function (t, b, c, d) {
return c*t/d + b;
};

Where do I put that code?
On ClipEvent action???
Frame Script?(i'm not beleive...)

Thanks for your help!

Ben

View Replies !    View Related
Using The Robert Penner Tweening Equations
Hey guys

Can anyone explain the way to use Robert Penner's tweening methods? I have all the files. I understand that at the top of the actions you do include# tween.as or something like that (I just had to reformat my powerbook and haven't loaded the files back on yet to look at exactly what that line of code is).

View Replies !    View Related
Using The Robert Penner Tweening Equations
Hey guys

Can anyone explain the way to use Robert Penner's tweening methods? I have all the files. I understand that at the top of the actions you do include# tween.as or something like that (I just had to reformat my powerbook and haven't loaded the files back on yet to look at exactly what that line of code is).

View Replies !    View Related
Robert Penner's Tweening And Core Classes (as 1.0 Versions)
ok, so I read robert penners book, and have used his tweening "classes" (the as1.0 versions) in a few movies, always publishing for flash 6 player, but this latest project uses MovieClipLoader so I have to publish as 7

when I do that, i seem to lose the ability to attach the addListener method to the MovieClip object. the code being used is below, the last trace line should return "function", but instead returns "undefined"

the motion and tween classes need this and therefore fail. what am I doing wrong???


ActionScript Code:
// set up MovieClip.addListener() if it doesn't exist
// and create an empty clip to broadcast onEnterFrame events
if (typeof MovieClip.addListener != 'function') {
    ASBroadcaster.initialize(MovieClip);
    mc = _level0.createEmptyMovieClip("$enterframe_source", 9876);
    mc.onEnterFrame = function () { MovieClip.broadcastMessage ("onEnterFrame") };
    delete mc;
}
trace(typeof MovieClip.addListener)

View Replies !    View Related
Hey Penner, Maybe You Can Help ;)
Code:
// easing code
Math.easeInCirc = function (t, b, c, d) {
return -c * (Math.sqrt(1 - t*t/(d*d)) - 1) + b;
}
// the movement..

this.onEnterFrame = function () {
t++
if (t <= duration) {
this._x =Math.easeInCirc (t, oldX, newX, duration);
this._y = Math.easeInCirc(t, oldY, newY, duration);
}
}
// the Event being listened for...

this.onIconSelect = function ( width, height, iconX, iconY) {
trace ( width +"+"+ height +"+"+ iconX +"+"+ iconY )
newW = width + 6
newH = height +6
newX = iconX;
newY = iconY;
oldX = this._x;
oldY = this._y;
t = 0;
}
ok the deal is, i have set up this MC so that when an mc im using as an icon is selected.. 'onIconSelect' is broadcasted and the code you see above you should cause the mc to move to where ever the mc is that the mouse is touching according to the args being passes along..
heres an example of how the event is broadcasted :

Code:
this.onRollOver = function () {
Mouse.broadcastMessage ('onIconSelect', this.width, this.height, this._x, this._y)
}
..ya get what im trying to say? .. the MC that i have this code in is going to be like a border that will fly to an mc that is touch to by the mouse, the newW and newH variables arent really being used at this point because im having trouble with the easing, instead of shooting to the next selected mc, the movie clip just keeps going all wacky as if the x and y values never decrease, only increase until it isnt even on the screen anymore.. help meee!!!

View Replies !    View Related
Penner's Equations
Is there anything that explains Robert Penner's equations a little more in-depth? I look at that code and I'm simply lost.

I don't know when or where to plug those numbers in to get a desired effect. How do I put these actions on buttons? For example, the bounce effect in his AS2 zip. Or the quadratic easing.

Yeah, I know. I'm way lost. But everyone's been there. I'm sure there are many that wish to know more.

If I need to be more specific, here are two effects I'd like:

1. A simple left-to-right motion of a movieclip with a bounce effect when it hits the end point. Not plain ol' elasticity, but Penner's bounce effect.

2. _x, _y, _xscale and _yscale changes on a movieclip to simulate a zoom.

View Replies !    View Related
Penner Snowflakes
Hi There,

Just my luck, I've got to work with snowflakes again. This time I found a Robert Penner version off of Ultrashock. Guess it's that time of year. He has 2 versions, one thats newer and more OOP oriented and an older version that I'm finding for my needs will provide a bit more immediate flexibility. The problem is when I export it for higher than Flash Player 5 it gives me an error.

There is no property with the name 'randRangeF'

That property is at the beginning of the snowfield_class.as file. Anyhow, I was hoping someone might be able to shed some light on this. I'd really like to use this version if possible but need to export at least Flash Player 7 preferably AS 2.0.

View Replies !    View Related
Penner Tweens
Hi everybody,

Can someone please direct me to a site where they explain well the equations and tween class developed by Robert Penner.Coz when I did research on the net they are just equations with no clear tut like explanations.For someone starting flash its pretty confusing.
I would like also some examples where they implement these classes.

Thanks in advance

v.B

View Replies !    View Related
Penner Snowflakes
Hi There,

Just my luck, I've got to work with snowflakes again. This time I found a Robert Penner version off of Ultrashock. Guess it's that time of year. He has 2 versions, one thats newer and more OOP oriented and an older version that I'm finding for my needs will provide a bit more immediate flexibility. The problem is when I export it for higher than Flash Player 5 it gives me an error.

There is no property with the name 'randRangeF'

That property is at the beginning of the snowfield_class.as file. Anyhow, I was hoping someone might be able to shed some light on this. I'd really like to use this version if possible but need to export at least Flash Player 7 preferably AS 2.0.

Also, I'm aware of the version on this site but I'd prefer to get this one working. Thanks.

View Replies !    View Related
Hey - Another Penner Thread.
Hello all,

I've done the search, I've read the threads, but I'm having a moment of stupidity .. I'm trying to get an example of the Penner tweens to work and I'm having problems. On the most basic scale, this is what I have. In frame 1:

Math.easeOut = function (t, b, c, d) {
if (t < d/2) return 2*c*t*t/(d*d) + b;
var ts = t - d/2;
return -2*c*ts*ts/(d*d) + 2*c*ts/d + c/2 + b;
}

then on a movieclip (of a round ball):

onClipEvent (load) {
start = this._x;
change = 100;
duration = 20;
t = 0;
}

onClipEvent (enterFrame) {
t++;
if (t <= duration) this._x = Math.easeOut(t, start, change, duration);
}


This is the error I get:

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 10: There is no property with the name 'easeOut'.
Math.easeOut = function (t, b, c, d) {

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 10: There is no method with the name 'easeOut'.
if (t <= duration) this._x = Math.easeOut(t, start, change, duration);

Total ActionScript Errors: 2 Reported Errors: 2


Is this something specific with Flash MX? I shouldn't need to declare/import a class, given the function is right there. Maybe I haven't gotten enough sleep, but this is something really stupid I'm missing. Any help would be much appreciated.

Thanks.

View Replies !    View Related
Rob Penner's Tutorials
Having problems opening the downloadable zipped tutorials of Rob Penner.
After unzipping them, I dragged them over to Flash Typer, a utility for Macs. The file changes to the right icon (flash icon) but still CANNOt open it. the error message is 'unexpected file format'. any help would be appreciated. thxs

hopper

View Replies !    View Related
Simplify My Penner Please
I've figured out Penner's tween AS functions and I am using it to animate my new site and its characters. I know that Flash 8 has such functions buiit in now, but I'm trying to use what I understand right now. Anyway, I've been animating things with 3 frame sets.

Frame 1, initialize:

//timers, start values, change values and durations
t= 0
t2=0

d=20

startY= this._y
startX = this._y
cY = -90
cX= 30
newY = startY + cY
newX = startX + cX

frame 2, action:

//calls Penner equations to move my characters
if(t<d){
t++
this._y = Math.easeOutSine(t,startY,cY,d)
this._x = Math.easeOutSine(t,startX,cX,d)
}

if(t>=d && t2<d){
t2++
this._y = Math.easeOutSine(t2,newY,-cY,d)
this._x = Math.easeOutSine(t2,newX,cX,d)
}

if(t2>=d){
stop();
}

frame 3, repeater:

gotoAndPlay(2);

Now all of this works, but it's quite a bulky way to arrange things and has gotten very confusing as I add each new animation. What I would like is to encompass this functionality in a function. BUt I can't figure our how to arrange it. There has got to be a simpler and smaller way to use this stuff! But I can't figure out how to get it all put in a self contained function when my current AS references external varialbles. None of this may make any sense to you, but does anyone please have any ideas how I can do this better? I need help because animating this site is taking forever!

Thanks Much for any Ideas,

Sam

View Replies !    View Related
Yet Another R. Penner Wrapper
Last edited by RAMPAGE201 : 2002-07-23 at 07:37.
























This is a piece to a larger project that I am working on. You should have the robert penner easing functions in a library indicated.

you can get the library on his page or my home page points to it. (under open source.)
http://www.nebulouscore.com/

The general idea:
ABS -- tween from an absolute begin, end value;
REL -- gets the current property value to fill in the start/end(b,c) values needed for the penner function

the result.flag indicates whether the tween has reached the desired value.


Code:
#include "..librarypennerEasing.as"

function PennerABS (pfunc, beginVal , endVal, duration) {
this.pennerFunc = pfunc
this.t = 0
this.b = beginVal
this.c = endVal - beginVal
this.d = duration
this.result = {val:0,flag:false};
this.Execute = function () {
this.result.val = eval(this.pennerFunc)(this.t, this.b, this.c, this.d)
this.result.flag = (this.t >= this.d)
this.t++;
return this.result
}
}
// pennerFunc values are relative to an objects target property
function PennerREL (pfunc, obj, prop, relVal, duration) {
this.pennerFunc = pfunc
this.t = 0
this.b = obj[prop]
this.c = relVal
this.d = duration
this.result = {val:0,flag:false};
this.Execute = function () {
this.result.val = eval(this.pennerFunc)(this.t, this.b, this.c, this.d)
this.result.flag = (this.t >= this.d)
this.t++;
return this.result
}
}

fred = new Object(); fred._x = 100;

foo = new PennerABS ("Math.linearTween", 0, 10, 10);
boo = new PennerREL ("Math.easeInQuad", fred,"_x", -10,10)

do { res = boo.Execute()
trace(res.val + ":" + res.flag) }
while (!boo.result.flag);

do { res = foo.Execute()
trace(res.val + ":" + res.flag) }
while (!foo.result.flag);

View Replies !    View Related
Help With Robert Penner Easing
I'm executing the following code to have 4 different panels slide to the top left corner when a button is clicked. The code seems perfectly fine, but it doesn't work. I'm using Macromedia Flash MX 2004 Pro on a Mac OS X.


[ edit: Decided to remove code ]

View Replies !    View Related
Penner Easing Not Easy For Me
Hi all,

I'm trying to apply some of the Penner code I found here somewhere. I have this AS on frame 1:

Math.easeInOutElastic = function (t, b, c, d, a, p) {
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
};

I have this in the first frame of my MC:

this.begin = this._x;
this.finish = 300;
this.change = this.finish - this.begin
this.duration = 50;
this.time = 0;
this.a = 0;
this.p = 6;

I have this on button #1:

on(release){
this.onEnterFrame = function (){
with(fred){
_x = Math.easeInOutElastic (time++,begin,change,duration);
if (time > duration) delete this.onEnterFrame;
}
}
}

Now, That all works fine. My little circle(MC named Fred)starts to move back and then glides to the right and stops. Pretty cool.

My problem is I want to make another button that will send my circle (Fred) back, or to another location, and it ain't happenin.

Here's what I have on button #2:

on(release){
this.onEnterFrame = function (){
with(fred){
finish = 100
_x = Math.easeInOutElastic (time++,begin,change,duration);
if (time > duration) delete this.onEnterFrame;
}
}
}

I'm sure that someone here knows how to make this happen. Please try not to make me feel to dumb. A Honda beat my VW this morning so I'm feelin a little low. http://www.58vw.com

-Lemorris

View Replies !    View Related
How Do I Use Robert Penner's Equations?
Can someone tell me how I use Robert Penner's equations?

What I want to do is move objects using Actionscript.
I want to have the objects move with accelerations and decelerations.

With the help of this website, I have gone a fair amount towards what I want to achieve. But... I'm kind scratching my head. Penner's code seems confusing and I'm not sure how I can use them.

Any help/pointers would be appreciated.

I've already got the following code (assigned to a movie object) that I can use to do most of what I want:

/* **********************
onClipEvent(load)
{
_x = 0;
_y = 0;
speed = 10;
speedx = speed;
speedy = speed;
}

onClipEvent(mouseDown)
{
targetx = _root._xmouse;
targety = _root._ymouse;
}

onClipEvent(enterFrame)
{
_x += (targetx - _x)/speedx;
_y += (targety - _y)/speedy;
}
********************** */

Thanks.


OM

View Replies !    View Related
Robert Penner Easing 2.0
Hi there,
i've downloaded the AS 2.0 easings from Rober Penner.

Does anyone has an simple example to use this easings on a mc for example...how does this function looks like?

Many thanks

Tim

View Replies !    View Related
Robert Penner Easing AS2.0
Hi,
does anyone has an example of an easing done with as 2.0...my as 1.0 files don't work anymore if i save it under 2.0...something to do with classes?

I already have the seperate *.as files but i have no idea how a function would look like...

Any help?

thnx
Tim

View Replies !    View Related
How Do I Use Penner's Equations In MX2004?
Can someone tell me how I use Penner's equations in MX2004?

I've nearly finished reading the book.
Thought it was really good.
It taught me a lot.

But... erm... I'm struggling to get his equations to work with his examples in MX2004.

I can't use Flash 6... because I'm using the video components in my Flash.

Some examples would be really useful.

Any help would be appreciated.

Thanks.

View Replies !    View Related
Penner Tween Conversion Help
Hello-
I am trying to comprise a library of functions (not classes, I know...not there yet) for easing and motion. I am writing in the following format:

function Easer(mcName, targetX, targetY, speed) {
if (Math.abs(targetX-mcName._x)<1 && Math.abs(targetY-mcName._y)<1) {
mcName._x = targetX;
delete mcName.onEnterFrame;
} else {
mcName._x += (targetX-mcName._x)*speed;
mcName._y += (targetY-mcName._y)*speed;
}
}

I am trying to convert a Cubic Ease In-Out function from Robert Penner to the above style of function in my library. Here is the penner class:

Math.easeInOutCubic = function (t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
};

I am not familiar with classes yet, nor what this Penner function translates to. Can anyone convert this Penner masterpiece into the above function style for a movieclip? I've tried, but am failing! Please help!

View Replies !    View Related
[F5] Randomize Penner's EaseOutBounce
My sliding text uses Robert Penner's easeOutBounce nicely to come to a halt just like train cars as each letter independently jars to a halt. Now I want to randomize some of the motion so the letter's halting appear less homogeneous. Anyone have a fuller understanding of the optimized code and where to play with some randomization of parameters? Here's the code of interest:

MovieClip.prototype.easeOutBounce = function (t, b, c, d){
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
}

View Replies !    View Related
Penner Tween Conversion Help
Hello-
I am trying to comprise a library of functions (not classes, I know...not there yet) for easing and motion. I am writing in the following format:

function Easer(mcName, targetX, targetY, speed) {
if (Math.abs(targetX-mcName._x)<1 && Math.abs(targetY-mcName._y)<1) {
mcName._x = targetX;
delete mcName.onEnterFrame;
} else {
mcName._x += (targetX-mcName._x)*speed;
mcName._y += (targetY-mcName._y)*speed;
}
}

I am trying to convert a Cubic Ease In-Out function from Robert Penner to the above style of function in my library. Here is the penner class:

Math.easeInOutCubic = function (t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
};

I am not familiar with classes yet, nor what this Penner function translates to. Can anyone convert this Penner masterpiece into the above function style for a movieclip? I've tried, but am failing! Please help!

View Replies !    View Related
Any Shame In Using Penner's Equations?
For those of you familiar with Robert Penner's easing equations, do you feel any shame using them? I mean, do you think that people who use Penner's formulas are unoriginal and such?

I like the equations, but I don't like taking someone else's code and using it (with credit of course)...but then again, I don't have the math skills just yet to create my own formulas...hm. So, does anyone see anything wrong with using Penner's (or anyone else's) equations?

View Replies !    View Related
Quick Penner Question With As1
hey,

i have used and loved penner's code for quite some time now. but i can't do 1 thing.

i made a function like this:


ActionScript Code:
function revealImg() {    initR = buttRight._x;    initL = buttLeft._x;    t = 0;    duration = 10;    this.onEnterFrame = function() {        if (t<duration) {            buttRight._x = Math.EaseInOutExpo(t, initR, 20, duration);        }        buttLeft._x = Math.EaseInOutExpo(t, initL, -20, duration);        t++;    };}


i have a movieclip with 10-20 frames in a row (don't ask why - it's what me boss wanted).

i want to put this code in every frame so when the playhead hits the frame, it will move buttRight and buttLeft by a certain amount (20) in this case.

now for the problem:

on each frame, buttRight and buttLeft are in different positions on the stage (like x = 50 on 1, x = 500 on 2).

how could i adapt my code so that it takes note of the new position of the butts on every frame, and then passes that to the function (that sits in frame 1).

do i need a listener of some sort? or am i complicating?

thanks

View Replies !    View Related
Robert Penner BOOK
I just got a copy of rober penners programming in mx.
Thing is i am usign mx 20004.
has anyone finished this book?
and does anyone knwo what is the diffrence witht he examples he has in 2004?

View Replies !    View Related
Any Shame In Using Penner's Equations?
For those of you familiar with Robert Penner's easing equations, do you feel any shame using them? I mean, do you think that people who use Penner's formulas are unoriginal and such?

I like the equations, but I don't like taking someone else's code and using it (with credit of course)...but then again, I don't have the math skills just yet to create my own formulas...hm. So, does anyone see anything wrong with using Penner's (or anyone else's) equations?

View Replies !    View Related
Quick Penner Question With As1
hey,

i have used and loved penner's code for quite some time now. but i can't do 1 thing.

i made a function like this:


ActionScript Code:
function revealImg() {    initR = buttRight._x;    initL = buttLeft._x;    t = 0;    duration = 10;    this.onEnterFrame = function() {        if (t<duration) {            buttRight._x = Math.EaseInOutExpo(t, initR, 20, duration);        }        buttLeft._x = Math.EaseInOutExpo(t, initL, -20, duration);        t++;    };}


i have a movieclip with 10-20 frames in a row (don't ask why - it's what me boss wanted).

i want to put this code in every frame so when the playhead hits the frame, it will move buttRight and buttLeft by a certain amount (20) in this case.

now for the problem:

on each frame, buttRight and buttLeft are in different positions on the stage (like x = 50 on 1, x = 500 on 2).

how could i adapt my code so that it takes note of the new position of the butts on every frame, and then passes that to the function (that sits in frame 1).

do i need a listener of some sort? or am i complicating?

thanks

View Replies !    View Related
Mr Penner's Invert Brighten .fla
How would you make that animation play backwards?

I mean start with a flat white, then make it reveal an image. I've seen that effect used loads, particularly on photographer's websites. I love it!

I'm not very good with AS at all!!!

View Replies !    View Related
Who Has Robert Penner's 3d Code Under As2?
These source code under as2 are just the updated source code version of his books-----<Flash MX Programming>.
I have remembered that I had downloaded them in someplace,but unfortunately I can't find them now.
Who can give me a link ?Or emil them to me.
EmilMatthew@hotmail.com
Thanks

View Replies !    View Related
[AS2] Robert Penner Equations
Hi there!

i try to include the easing equations of Robert Penner in Mx Pro using the same old include statement:

#include "easing_equations.as"

But in the output window, and get the following:

**Error** There is no property with the name 'easeOutElastic'.
**Error** There is no property with the name 'easeInOutElastic'.
**Error** There is no property with the name 'etc...

---

In the actionscript dictionnary, they say:

All of the properties for the Math class are constants and they list a bunch constants. It does'nt help me much.

Should i get rid of the Math in ex:

Math.linearTween = function (t, b, c, d) {
return c*t/d + b;
};

and replace it by

_global or MovieClip.prototype, or ....


If anyone have an idea, please share
thx

View Replies !    View Related
A Very Simple Penner Prototype
I developed this just to have a generic function for animating simple things.

Code:
#include "ease.as"
MovieClip.prototype.initEase = function(prop, targ, dur, meth) {
this.prop = prop;
for (i=0; i<prop.length; i++) {
this["prop"+i] = prop[i];
this["t"+i] = getTimer();
this["targ"+i] = targ[i];
this["dur"+i] = dur[i]*1000;
this["meth"+i] = meth[i];
this["s"+i] = this[prop[i]];
this["c"+i] = this["targ"+i]-this[this["prop"+i]];
}
for (i=0; i<prop.length; i++) {
this["easer"+prop[i]+i] = setInterval(doEase, 10, this);
}
};
MovieClip.prototype.doEase = function(w) {
for (i=0; i<w.prop.length; i++) {
var now = getTimer();
var diff = now-w["t"+i];
if (diff<w["dur"+i]) {
var z = Math[w["meth"+i]](diff, w["s"+i], w["c"+i], w["dur"+i]);
w[w["prop"+[i]]] = z;
} else {
clearInterval(w["easer"+w["prop"+i]+i]);
w[w["prop"+[i]]] = w["targ"+i];
}
}
};
I think all of the parameters are self explanatory. The dur properties are multiplied by 1000 so I can just enter seconds. The meth parameter is which Penner easing equation you want to use.

Thank you Mr. Penner

If anyone has any suggestions on how to improve or optimize the code I am all ears. Please tell me how my programming sucks.

Thanks
Mike

View Replies !    View Related
Easing Prototpye Via Mr. Penner
Ok - here's the code i've got
[thanks to the oh so popular Mr. Penner]

code:
MovieClip.prototype.inOutQuad = function(t, b, c, d) {
if ((t /= d/2)<1) {
return c/2*t*t+b;
}
return -c/2*((--t)*(t-2)-1)+b;
};
MovieClip.prototype.inQuad = function(t, b, c, d) {
return c*(t /= d)*t+b;
};
MovieClip.prototype.outQuad = function(t, b, c, d) {
return -c*(t /= d)*(t-2)+b;
};
MovieClip.prototype.easeInit = function(prop, dur) {
this.t = 0;
this.prop = prop;
this.startVal = this[this.prop];
this.dur = dur;
};
MovieClip.prototype.easeProp = function(moveType, targ) {
this.t++;
if (this.t<this.dur) {
var change = targ-this[this.prop];
var goTo = this[moveType](this.t, this.startVal, change, this.dur);
this[this.prop] = goTo;
} else {
return false;
}
};


And the usage in any clip:

code:
onClipEvent (load) {
easeInit("_x", 200);
var doIn = true;
}
onClipEvent (enterFrame) {
if (doIn) {
chkIn = easeProp("inOutQuad", 800);
if (chkIn == false) {
doIn = false;
}
}
}



Everything works great except for the fact that whatever target value you specify is cut in half.
For example, if I tell it to move the _x property to 400 from 4, it will go to 200 and be done.

What am I doing wrong?

View Replies !    View Related
Robert Penner Easing And Wiggling
howdy peeps,

alrighty, got this far:


Code:
newDepth = 1;
_root.bar.buttons.leaf2.onPress = function() {
startDrag(this);
// constantly wiggle the leaf somehow as long as its held with mouse
}
_root.bar.buttons.leaf2.onRelease = function() {
_root.bar.reverse = true;
stopDrag();
//move the leaf back to its original point with easing
if (eval(this._droptarget) == _root.target) {
newDepth++;
var h = link.createEmptyMovieClip("holder"+newDepth, newDepth);
h.loadMovie("/gallery/IMG01.jpg", "_root.holder"+newDepth);
preLoader(h);
}
}


the above works k, next tasks are those in bold in the comment lines above, ive downloaded robert penners easing quotations, id like to use his easing back one :


Code:
class com.robertpenner.easing.Back {
static function easeIn (t:Number, b:Number, c:Number, d:Number, s:Number):Number {
if (s == undefined) s = 1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
}
static function easeOut (t:Number, b:Number, c:Number, d:Number, s:Number):Number {
if (s == undefined) s = 1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
}
static function easeInOut (t:Number, b:Number, c:Number, d:Number, s:Number):Number {
if (s == undefined) s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
}
}


... 1) problem is which part of this do i use, and how do i put it in my document?
2) second thing is can someone advise on how to store the leaf Mclips position (x+y) before the drag function so that it may be "put back" with easing adter the user has then released it/dropped it onto my target clip?
would it be something like var place = _root.bar.buttons.leaf2._x && _y ?? and then after it has been dropped then go perhaps something like place; ??

please could someone advise me on these issues?

thanks a lot

View Replies !    View Related
How Do I Make The Penner Equation Work?
Do I put the code on the movie clip?

How do I make it do what i want?


// bounce easing out
Math.easeOutBounce = function (t, b, c, d) {
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
};

View Replies !    View Related
Mx.transitions, TweenExtended, Penner, Laco ?
mx.transitions, tweenExtended, Penner, laco and Fuse Kit - I'm confused

I'm pretty new in the AS tweening.
I have played with Flash built in tweens and the TweenExtended posted on this board by Devo.
Then i heard about Robert Penners tweens which as I understand is what have actually been built in by Macromedia in MX2004 ?
Then theres lacos tweens and something called Fuse Kit that I don't know much about yet.

My question is - if it's possible to answer at all - which of these is best ?
And if they all have a situation where they each work best - then which do I choose when ?

View Replies !    View Related
Robert Penner Class Problem
Code:
import com.robertpenner.easing.Back;

function thumbRollOver(){
var test = new mx.transitions.TweenExtended(this, ["_xscale", "_yscale", "_x", "_y"], com.robertpenner.easing.Back.easeOut, [100, 100, this.x, this.y], [120, 120, this._x + this._width / 10, this._y + this._height / 80], 4.000000E-001, true);
}
I did nor write that transition. I find it on the internet, and I saw com.robertpenner.easing.Back.easeOut. So I started a research on that but I am stuck. I am doing something wrong, cause it's not working.... If anyone could help me, that would be great

View Replies !    View Related
Mx Transitions To Fuse Kit Penner Easing
Im currently using the mx transitions but for me to learn fuse a lot easier, I want to take this code and try and covert it. Any ideas?


Code:
import mx.transitions.Tween;
import mx.transitions.easing.Bounce;

tweenX = new Tween(logo, "_x", Bounce.easeOut, logo._x, Stage.width/2, 20, false);
tweenY = new Tween(menu, "_y", Bounce.easeOut, menu._y, Stage.height/2, 20, false);

Code:
import com.mosesSupposes.fuse.*;
ZigoEngine.register(Fuse, PennerEasing);

?

View Replies !    View Related
Penner Easing: Shift In Direction(?)
There have been a few flash movies I've seen lately where it is obvious that an easing prototype was being used (Penner)...

But the movement of an object would change its direction a bit or swoop slightly midway.

Since the prototype movement Im used to is from point A to point B with easing, I am curious how you could direct an object to kind of "shift" its course within the boundaries of the easing prototypes.

Hope this all sounds vaguely familiar?? ;-)

Love to hear any ideas

View Replies !    View Related
Robert Penner Easing Equations How Do I Use Them
Hey,
I am just wandering how do i use the equations I downloaded from robertpenner.com.

when ever i try even working out of the book i get error messages like

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 350: There is no method with the name 'easeOutBounce'.
return(Math.easeOutBounce(t * 2 - d, 0, c, d) * 0.500000 + c * 0.500000 + b);

Why does it say there is no method with the name bounceEaseOut

Can someone tell me who i can use these in my flash movies. I tried everything out of his book and i still get it wrong.

Thanks nugget

View Replies !    View Related
LoadMovie With Sequential Penner Tweens
OK, now that that confusing subject caught your eye maybe I can get some pointers. I have a series of 7 swfs that are all created using the kickass penner tweens. So basically using the delay in the tweens to create the timeline. I want to compile all of them in a container swf so it plays something like this:
Container
1.swf 31 = seconds long
2.swf 30 = seconds long
3.swf 36 = seconds long
4.swf 28 = seconds long

When I use a simple
loadMovie("1.swf",container);
or whatever it plays fine, but how do I get the second and third swf to load and do so after a specific delay.

Thanks!

View Replies !    View Related
Protos, Penner, Easing And All That Jazz...
Hey everyone,

I would like to get into this easing/protos/penner stuff I have seen on the web it looks really cool, and it seems everyone is using it these days.

How would I get started on this? I have read the Kirupa tutorial on it, and though it is a great tutorial, I'm still very confused after reading it. Is there any other way that I can learn this stuff? I need some really basic understanding of it, perhaps a simple tutorial I can follow along with. By the end my goal is to be able to use it in any website for any element in flash, or something like this: http://www.bluri.com/

Any direction would be greatly appreciated.

THE MIGHTY MIGHTY DIMSUM

View Replies !    View Related
Penner Easing Equation Problems
I have a actionscript 2 file that I am trying to perform some of the penner easing equations; however, everytime I try to publish the file it spits out this error "There is no property with the name 'easeOutElastic'. But when I am in the code window and I check for actionscript errors it displays that I have no errors. The errors only happen when I export the file. Is this the way I am calling the easing functions? Thanks for your help.


function onRelease()
{
this.stopDrag();
this.begin = this._x;
this.change = -begin;
this.duration = 16;
this.time = 0;
this.onEnterFrame = function ()
{
++this.time;
if (this.time < this.duration)
{
this._x = Math.easeOutElastic(this.time, this.begin, this.change, this.duration, 5, 5);
}
else
{
delete this.onEnterFrame;
} // end else if
};
} // End of the function
function onReleaseOutside()
{
onRelease();
} // End of the function
var begin;
var change;
var duration;
Number;
var time;
Math.easeOutElastic = function (t, b, c, d, a, p)
{
if (t == 0)
{
return (b);
} // end if
t = t / d;
if (t == 1)
{
return (b + c);
} // end if
if (!p)
{
p = d * 3.000000E-001;
} // end if
if (a < Math.abs(c))
{
a = c;
var _loc7 = p / 4;
}
else
{
_loc7 = p / 6.283185E+000 * Math.asin(c / a);
} // end else if
return (a * Math.pow(2, -10 * t) * Math.sin((t * d - _loc7) * 6.283185E+000 / p) + c + b);
};
}

View Replies !    View Related
Robert Penner Easing Equations How Do I Use Them
Hey,
I am just wandering how do i use the equations I downloaded from robertpenner.com.

when ever i try even working out of the book i get error messages like

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 350: There is no method with the name 'easeOutBounce'.
return(Math.easeOutBounce(t * 2 - d, 0, c, d) * 0.500000 + c * 0.500000 + b);

Why does it say there is no method with the name bounceEaseOut

Can someone tell me who i can use these in my flash movies. I tried everything out of his book and i still get it wrong.

Thanks nugget

View Replies !    View Related
LoadMovie With Sequential Penner Tweens
OK, now that that confusing subject caught your eye maybe I can get some pointers. I have a series of 7 swfs that are all created using the kickass penner tweens. So basically using the delay in the tweens to create the timeline. I want to compile all of them in a container swf so it plays something like this:
Container
1.swf 31 = seconds long
2.swf 30 = seconds long
3.swf 36 = seconds long
4.swf 28 = seconds long

When I use a simple
loadMovie("1.swf",container);
or whatever it plays fine, but how do I get the second and third swf to load and do so after a specific delay.

Thanks!

View Replies !    View Related
Easing With ActionScript + Robert Penner
I'm trying to figure out how to do some easing animation through actionscript. After digging around the forum archives for a bit, it seems like the way everyone is doing this is with Robert Penner's easing equations. I'm a little confused as to how to implement these equations. Is there a tutorial or a very simple .fla example file of a usage of this easing? Any help would be much appreciated.

-Aaron

View Replies !    View Related
[mx+ Penner Ext.]listeners In _global.MyClass ...
listeners in _global.MyClass ...
i want to close some movements in one class witch is based on penners code..


ActionScript Code:
_global.movePlus = function(new1,new2,new3,new4){
        this._listeners = [];
        this.addListener(this)
        this.move(new1,new2,new3,new4)
}
 
var MP = movePlus.prototype;
ASBroadcaster.initialize(MP);
MP.sendNews = function(){
       
}
MP.move = function(new1,new2,new3,new4){
        f = Math.easeOutExpo
        t = 2
        MovieClip.addListener(this);
        for(i=1;i<=4;i++) {
                var mc = eval("p"+i);
                trace(mc);
                this["p"+i+"T"] = new Tween(mc, "_x", f, mc._x, this["new"+i], t , true)
        }
        this["p4T"].onMotionFinished = function(){this.broadcastMessage("onEnd", this)}
}
 
delete MP
aa = new movePlus(200,200,200,200);
aa.onEnd = function(){trace("!");}


why aa.onEnd doesn't work ?

View Replies !    View Related
Take Me To The Promised Land....Penner's Easing Eq
I found this code and don't know how to make it work. Could you guide me? What do I have to do to make this function...i.e. where does this code go, and how do I trigger it with a button?

Thanks.

///////////// EXPONENTIAL EASING: 2^t /////////////////

// exponential easing in - accelerating from zero velocity
// t: current time, b: beginning value, c: change in position, d: duration
Math.easeInExpo = function (t, b, c, d) {
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
};

// exponential easing out - decelerating to zero velocity
Math.easeOutExpo = function (t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
};

// exponential easing in/out - accelerating until halfway, then decelerating
Math.easeInOutExpo = function (t, b, c, d) {
if (t==0) return b;
if (t==d) return b+c;
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
};

View Replies !    View Related
_root Question For Herr Penner
Mr. Penner,

I've read your admonitions to avoid using _root but I'm left wondering what to use in it's stead. Allow me to offer a specific example and perhaps you might be willing to proffer your opinion as to how it should be handled.

I am building a site that comprises several discrete coldfusion templates, each containing a swf. I've constructed an object model for the nav system which will be contained in its own swf which will be loaded by the swfs on each page. The nav will comprise mcs nested inside of one container mc. Here's the question: Where should I attach the container? My first instinct is on _root, but if not there, where?

Thanks in advance for any wisdom you feel inclined to bestow.

View Replies !    View Related
Robert Penner's Easing Equations
Where can I find some examples of these on the web? Not source code, but SWF examples.

Thanks.

View Replies !    View Related
Robert Penner Easing Equations
I'm not really an actionscript wizard, so I could use a little help here.

I want to use the quadratic easing in/out equation, but I'm not really sure how to apply it in flash. I am using it to move a movieclip, so if anyone could provide me with a description on how to do this, I'd be grateful.



thanks in advance.

View Replies !    View Related
Penner, Easing, Buttons, Confusion.
Okay, thanks to Mr. Penner's fantastic easing equations I am trying to develop some movie ideas. One problem I am having is this...

I am trying to move a movie clip to certain positions on the stage, currently defined by movieclips (holder1,2,3).
Now, I can make my movieclip(tao) move to the different positions on the stage by clicking on the corresponding buttons button 1 2 or 3, moves to holder1, holder2, and holder3. the problem is this...

Say the movie loads and I want to go to holder2. Okay, I press the #2 button, and the clip moves. Super! Now, I want to go to #1. I press #1, and the clip(tao) places itself back at its ORIGINAL starting positon(not holder2) and moves to holder1...

The affect I am trying to achieve, is something like Joshua Davis's barney effect without all the code... Any and all help would be appreciated, here is the code for the tao MC


Code:
onClipEvent(load){
duration = 20;
}
onClipEvent (enterFrame) {
if (t<=duration) {
this._x = Math.easeInOutCubic(t++, startX, endX, duration);
}
}
the code on the buttons...


Code:
on(release){
_root.tao.endX = _root.holder._x;
_root.tao.t = 0;
}
please please please help ! thanks in advance !

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved