If you're using eval, you're doing it wrong :)

http://jsfiddle.net/rpflorence/MZKWW/

Morph instance + dynamically built array of instructions + each = a chain of 
effects.

On Jan 31, 2011, at 2:03 PM, Trevor Orr wrote:

> I got it to work, probably not the most elegant solution but it does work.  
> What I came up with it build a string with the Fx.move.start.chain commands 
> and then use eval on the string.
> 
> Is this a horrible solution?  I am pretty new to transitions/effects so 
> really look for some constructive criticism.
> 
> Here is my jsfiddle of the working version, I did not mention this last time 
> but you click in the black box to move the blue element.
> 
> http://jsfiddle.net/u2eLj/2/
> 
> 
> 
> 
> On Mon, Jan 31, 2011 at 12:00 PM, Trevor Orr <[email protected]> wrote:
> That is an interesting idea, too bad I am not a math genius.  The other thing 
> to this whole issue is that what I am using this for actually has 120 points 
> in each path and I have about 50 different paths to available to choose from.
> 
> So I guess I need to do some reading up on Fx.Transition? 
> 
> 
> 
> On Mon, Jan 31, 2011 at 11:56 AM, Ryan Florence <[email protected]> wrote:
> What you really need is a math genius to take all those points, write a new 
> fx.transition, and then use it.
> 
> 
> 
> On Jan 31, 2011, at 11:44 AM, Sean McArthur <[email protected]> wrote:
> 
>> argSet.forEach(function(args) {
>>     myFx.start(args)
>> });
>> 
>> 
>> 
>> On Mon, Jan 31, 2011 at 10:31 AM, Trevor Orr <[email protected]> wrote:
>> Okay I figured out one of my problems with the usage of the chain but I am 
>> still getting the same problem with it jump to the last point after moving 
>> to the first point.
>> 
>> The problems with using your method is that the number of times the element 
>> movers varies every time it is call, one time it could be 2 points, the next 
>> time it could be 16 points.
>> 
>> 
>> 
>> 
>> On Mon, Jan 31, 2011 at 9:44 AM, Ryan Florence <[email protected]> wrote:
>> I haven't worked a lot with Chain, but it doesn't just go hog-wild and run 
>> every function.  Rather, whenever you callChain, it calls the next function 
>> and then removes it from the chain.
>> 
>> Instead, you probably just need to utilize the link: 'chain' option for an 
>> effect:
>> 
>> myFx = new Fx.Morph('el', { link: 'chain'});
>> myFx.start(args).start(args).start(args).start(args).start(args);
>> 
>> That will chain the effects.  There's even a chainComplete event for Fx when 
>> all of them are finished.
>> 
>> On Jan 31, 2011, at 10:32 AM, Trevor Orr wrote:
>> 
>>> I am having problems getting the chain to work, what I am trying to do is 
>>> to move an element along a curved line, the line is made of a bunch of 
>>> points. Instead of moving directly from point 1 to say point 6 I want it 
>>> move from point to point along the curve until it reaches the final desired 
>>> point.
>>> 
>>> I have a function called movePeg which I pass in a number of points to 
>>> move, this function builds an array of functions to call which is passed 
>>> into the a new Chain class, which from my understanding these functions 
>>> should get called once the previous function has completed. The function 
>>> called uses a Fx.Move to move the element from the current position to the 
>>> next position in the curve, thus giving the desired effect, or at least I 
>>> thought it would have.
>>> 
>>> Any help on what I am missing/doing wrong would be greatly appreciated.
>>> 
>>> The blue square is supposed to move the one red box to the next, it seems 
>>> to move to the first one and jump to the last one.
>>> 
>>> Here it is on jsfiddle.
>>> 
>>> http://jsfiddle.net/u2eLj/
>>> 
>>> 
>>> 
>> 
>> 
>> 
> 
> 

Reply via email to