That would be great!

Specifically, there are a few things I did want opinions on:


- At the moment, if more than one parameter is passed to the construction of a preset, they must be in an array:

var showOne = new Fx.Elements.Preset(Fx.Presets.Unique, [{opacity:1}, {opacity:0}]);

It is possible to just have them as a list of extra parameters:

var showOne = new Fx.Elements.Preset(Fx.Presets.Unique, {opacity:1}, {opacity:0});

Or make it an object with named entries (where what the 'names' are is defined in the presets)

var showOne = new Fx.Elements.Preset(Fx.Presets.Unique, {single: {opacity:1}, other: {opacity:0}});

I'm not sure what is better.


- At the moment, when 'combining' presets (using the Fx.Elements.Preset instance to control not just an array of elements, but multiple arrays of elements at the same time), The syntax is requires that you construct Fx.Elements.Preset instance by passing an 'array of arrays'. Then to the start method must be passed an array of presets, the order of which is important: the first preset is applied to the first array and so on. Say to highlight the ith 'header' and show ith 'content', currently the syntax is:

/* Construct Fx instance and presets */
var myFx = new Fx.Elements.Preset([contentEls, headerEls]);
var showOne = new Fx.Elements.Preset(Fx.Presets.Unique, [{opacity:1}, {opacity:0}]); var highlightOne = new Fx.Elements.Preset(Fx.Presets.Unique, [{'background-color':#ff0000},{'background-color':'#ff0000'}]);

/* To highlight ith header and show ith content */
myFx.start([showOne,  highlightOne], i);

It crossed my mind to name each array of elements:

/* Construct Fx instance and presets */
var myFx = new Fx.Elements.Preset({contents: contentEls, headers: headerEls}); var showOne = new Fx.Elements.Preset(Fx.Presets.Unique, [{opacity:1}, {opacity:0}]);
var highlightOne = new Fx.Elements.Preset(Fx.Presets.Uni

/* To highlight ith header and show ith content */
myFx.start({contents: showOne,  headers: highlightOne}, i);

This syntax makes the start command clearer: what happens to each each group of elements is explained using the names. The 'showOne' preset is applied to the 'contents' and the 'highlightOne' preset is a applied to the 'headers'. This makes the code 'locally self- documenting' which I am generally a fan of.


Michal.



On 8 Apr 2009, at 22:37, nwhite wrote:

Michal,

I remember your post. I have actually been thinking about Fx.Presets recently as I recall the ability to manage animate/control multiple elements with a single Fx instance. I think this is a great idea as it could save a lot on cpu utilization. I have not looked closely at the code nor implemented it, I have been rather busy. I do plan on examining this closer when I pick back up on an idea I have. I will make sure to give you feedback when I do.

Great job.

On Wed, Apr 8, 2009 at 5:27 PM, Michal <[email protected]> wrote:

Hi,

A while ago I released two plugins:

Fx.Presets http://yetagain.net/fxpresets/
Fx.Chains http://yetagain.net/fxchains/

With some extra basic examples and explanation over at mooforum:

http://www.mooforum.net/scripts12/presets-preset-animations-for-elements-t1001.html
http://www.mooforum.net/scripts12/chains-preset-chains-for-elements-t1027.html

They essentially remove the need of faffing with integers or looping
when dealing with arrays of elements that must be transitioned, either
singularly with Fx.Presets or in a chain with Fx.Chain.

When I wrote them I actually thought they were quite good and could be
used in a number of situations. However, I've not received any
feedback (good or bad). Can I ask if people could offer some? Perhaps
I've not explained it well enough, or my examples aren't clear...?

Michal.


Reply via email to