Deprecated: Assigning the return value of new by reference is deprecated in /var/www/sdb/8/f/dev.art/wordpress/wp-settings.php on line 472

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/sdb/8/f/dev.art/wordpress/wp-settings.php on line 487

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/sdb/8/f/dev.art/wordpress/wp-settings.php on line 494

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/sdb/8/f/dev.art/wordpress/wp-settings.php on line 530

Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl(&$output) in /var/www/sdb/8/f/dev.art/wordpress/wp-includes/classes.php on line 594

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl(&$output) in /var/www/sdb/8/f/dev.art/wordpress/wp-includes/classes.php on line 594

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el(&$output) in /var/www/sdb/8/f/dev.art/wordpress/wp-includes/classes.php on line 594

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el(&$output) in /var/www/sdb/8/f/dev.art/wordpress/wp-includes/classes.php on line 594

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el(&$output) in /var/www/sdb/8/f/dev.art/wordpress/wp-includes/classes.php on line 611

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl(&$output) in /var/www/sdb/8/f/dev.art/wordpress/wp-includes/classes.php on line 705

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl(&$output) in /var/www/sdb/8/f/dev.art/wordpress/wp-includes/classes.php on line 705

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el(&$output) in /var/www/sdb/8/f/dev.art/wordpress/wp-includes/classes.php on line 705

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el(&$output) in /var/www/sdb/8/f/dev.art/wordpress/wp-includes/classes.php on line 705

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el(&$output) in /var/www/sdb/8/f/dev.art/wordpress/wp-includes/classes.php on line 728

Strict Standards: Redefining already defined constructor for class wpdb in /var/www/sdb/8/f/dev.art/wordpress/wp-includes/wp-db.php on line 306

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/sdb/8/f/dev.art/wordpress/wp-includes/cache.php on line 103

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /var/www/sdb/8/f/dev.art/wordpress/wp-includes/cache.php on line 425

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/sdb/8/f/dev.art/wordpress/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/sdb/8/f/dev.art/wordpress/wp-includes/theme.php on line 623

Strict Standards: Redefining already defined constructor for class WP_Dependencies in /var/www/sdb/8/f/dev.art/wordpress/wp-includes/class.wp-dependencies.php on line 15

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method Wordics::myWordics_init() should not be called statically in /var/www/sdb/8/f/dev.art/wordpress/wp-includes/plugin.php on line 311
Développement et arts numériques » Mootools
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /var/www/sdb/8/f/dev.art/wordpress/wp-includes/kses.php on line 947

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /var/www/sdb/8/f/dev.art/wordpress/wp-includes/kses.php on line 948

Archive

Posts Tagged ‘Mootools’

Mootools, évènements chainés

mai 8th, 2012

Ayant dédiés les deux dernières semaines à Mootools, je me suis décidé à vous écrire
afin de décrire quelques une des techniques simples que je viens de redécouvrir, elles vont
sont peut être déjà connues, si c’est le cas veuillez ne pas m’en vouloir.

Pour résumer, la première technique permet l’utilisation de méthodes statiques ou
d’objets statiques :

var ObjA = new Class({...});
ObjA.fct = function(){...};
ObjA.var = "val";

Tandis que la deuxième technique permet d’utiliser les chaines d’évènements afin de lier des
comportements successifs de nature différentes, sur des objets différents :

var classA = new Class({
	Implements: [Chain, Events],
	initialise: function(element){
		this.element = element
		this.other_element = element.appendChild(new Element('img'))
		//Initialise les évènements permettant d'enchainer et de réinitialiser les functions
		this.addEvent('init_completed:pause(100)', function(){this.callChain()}.bind(this));
		this.addEvent('reinit:throttle(100)', function(){this.clearChain()}.bind(this));
		//Initialisation des effets
		this.morph = new Fx.Morph(this.element, {
			link:'ignore', //Permet de controler l'enchainement
			onComplete: function(){this.callChain()}.bind(this)
		})
		this.move_shutter.chain = this.chain;
	},
	close: function(){
		this.fireEvent('reinit');
		this.chain(
			function(){
				console.log('close_start');
				this.morph.start({'bottom':[this.bottom_shutter, this.element.getHeight()]})
				}.bind(this),
			function(){
				this.element.removeChild(this.container);
				this.callChain();
				}.bind(this)
		);
		this.fireEvent('init_completed');
		return this;
	},
	open: function(){
		this.fireEvent('reinit');
		this.chain(
			function(){
				console.log('open_start');
				this.element.appendChild(this.container); 
				this.callChain();
			}.bind(this),			
			function(){
				this.container.fade('show'); //Cet effet est instantanné,
				                             //sinon, il ne pourrait être utilisé ici sans un wait
				this.callChain();
			}.bind(this),			
			function(){
				//Utilisation d'un effet non prédéfini
				this.element.move({
					duration:'long',
					transition:'bounce:out',
					offset:{x: 10, y: 100},
					onComplete: function(){this.callChain()}.bind(this)});
			}.bind(this)
		);
		this.fireEvent('init_completed');
		return this;
	}
})

L’appel peut ensuite être effectué ainsi :
new ObjA().open().wait(3000).close(); //3000ms est non le temps attendu à la fin de l’animation, mais celui
//commencant juste après l’enregistrement des différentes fonctions ~10ms

Author: Nicolas de Marqué Categories: Web Tags: ,