On Wed, Oct 22, 2008 at 9:05 AM, Iván N Paz <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> Im extending Fx.Morph onto another class that will basicly have the same
> functionality plus other stuff it doesnt do right now (i.e. bezier pathing)
>
> Maybe I've gotten wrong the whole implement/extend deal, and have surfed a
> lot thru all the threads in here that treat such subject, and Aaorons book
> as well....
>
> Well... to the point... this is what I have:
>
>
> Fx.MorphPath = new Class({
>
>     Extends: Fx.Morph,
>
>     compute: function(from, to, delta){
>         var now = {};
>         //check if we have a motion path
>         var mp = (this.options.motionpath ? this.options.motionpath : false);
>         for (var p in from)
>         {
>             //motionpath is only applied to top/left css properties
>             if(mp) {
>                 var coords = mp.getCoordinates(1-delta);
>                 var x = coords.x + 'px';
>                 var y = coords.y + 'px';
>             }
>             //Go rewriting as usual, but take motionpath in consideration 
> now...
>             if(p == 'left' && mp){
>                 //calculate X movement (left)
>                 now[p] = x;
>             }else if(p == 'top' && mp){
>                 //calculate Y movement (top)
>                 now[p] = y;
>             }else{
>                 //standard mootool calculation
>                 now[p] = this.parent(from[p], to[p], delta);
>             }
>         }
>         return now;
>     }
>
> });
>
> So, where's the problem... the problem lies, in that I can do the bezier
> pathing morphin thingy without problem BUT if I try to also morph another
> property such as width, opacity, whatever, it breaks....
>
> I suspect the problem is here:
>
>                 //standard mootool calculation
>                 now[p] = this.parent(from[p], to[p], delta);

Main Problem is, you have to call the Fx.CSS's compute, and not Fx.Morph.

What I would suggest, is
a) to "fork" Fx.Morph into your own Fx.MorphPath.
b) pass this.parent(from, to, delta) instead.

Regards
Rajeev j Sebastian

Reply via email to