Sha256: c05ec679696b3dafff23f4f25732e77a383732920dabc6aaa688aa2b6d092e03

Contents?: true

Size: 1.25 KB

Versions: 7

Compression:

Stored size: 1.25 KB

Contents

/*
---

script: Fx.Elements.js

name: Fx.Elements

description: Effect to change any number of CSS properties of any number of Elements.

license: MIT-style license

authors:
  - Valerio Proietti

requires:
  - Core/Fx.CSS
  - /MooTools.More

provides: [Fx.Elements]

...
*/

Fx.Elements = new Class({

	Extends: Fx.CSS,

	initialize: function(elements, options){
		this.elements = this.subject = $$(elements);
		this.parent(options);
	},

	compute: function(from, to, delta){
		var now = {};

		for (var i in from){
			var iFrom = from[i], iTo = to[i], iNow = now[i] = {};
			for (var p in iFrom) iNow[p] = this.parent(iFrom[p], iTo[p], delta);
		}

		return now;
	},

	set: function(now){
		for (var i in now){
			if (!this.elements[i]) continue;

			var iNow = now[i];
			for (var p in iNow) this.render(this.elements[i], p, iNow[p], this.options.unit);
		}

		return this;
	},

	start: function(obj){
		if (!this.check(obj)) return this;
		var from = {}, to = {};

		for (var i in obj){
			if (!this.elements[i]) continue;

			var iProps = obj[i], iFrom = from[i] = {}, iTo = to[i] = {};

			for (var p in iProps){
				var parsed = this.prepare(this.elements[i], p, iProps[p]);
				iFrom[p] = parsed.from;
				iTo[p] = parsed.to;
			}
		}

		return this.parent(from, to);
	}

});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lsd_rails-0.1.6 Packages/mootools-more/Source/Fx/Fx.Elements.js
lsd_rails-0.1.5 Packages/mootools-more/Source/Fx/Fx.Elements.js
lsd_rails-0.1.4 Packages/mootools-more/Source/Fx/Fx.Elements.js
lsd_rails-0.1.3 Packages/mootools-more/Source/Fx/Fx.Elements.js
lsd_rails-0.1.2 Packages/mootools-more/Source/Fx/Fx.Elements.js
lsd_rails-0.1.1 Packages/mootools-more/Source/Fx/Fx.Elements.js
lsd_rails-0.1 Packages/mootools-more/Source/Fx/Fx.Elements.js