I'd say (to get a grasp of how compute() really works) use FF &
Firebug, use breakpoints to break & step through the code, and check
what this.parent refers to. Depending how compute() gets call, i.e.
through delays/periodicals, you might need to use something like
arguments.callee.parent instead.

On Oct 21, 11:35 pm, "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);
>
> Im trying to let normal Fx.Morph do the rest of the calculation and
> cascading... but this is breaking as hell...
>
> Am I making some stupid mistake, bad concept or anything??? SHould I do
> implement instead? Any ideas?
>
> Thanks for your time
> Iván

Reply via email to