<commit_before>Molecule.module('Molecule.Animation', function (require, p) {

	function Animation() {
		this.frame = new Array();
		this.id = new Array();
		this.current = {animation: 0, frame: 0};
		this.timer = 0;
		this.loop = true;
		this.reverse = false;
		this.halt = false;
	};
	
	// Method to get frames of the sprite sheet
	Animation.prototype.sliceFrames = function(_imageWidth, _imageHeight, _frameWidth, _frameHeight) {
		for(var i = 0; i < _imageHeight - 1; i += _frameHeight) {
			for(var j = 0; j < _imageWidth - 1; j += _frameWidth) {
				this.frame.push({x:j, y:i});
			}
		}
		if(_imageWidth === _frameWidth && _imageHeight === _frameHeight) {
			this.add('', [0], 60);
		}
	};
	
	// Method to add an animation
	Animation.prototype.add = function(_name, _frames, _speed) {
		this.id.push({name: _name, frame: _frames, speed: _speed});
	};
	
	//Method to play current animation
	Animation.prototype.run = function(_name, _loop, _reverse) {
	    _loop = _loop === undefined ? true : _loop;
	    _reverse = _reverse === undefined ? false : _reverse;
		this.loop = _loop;
		this.reverse = _reverse;
		this.halt = false;
		if(this.current.animation === -1 || this.id[this.current.animation].name !== _name) {
			this.current.frame = -1;
			for(var i = 0; i < this.id.length; i++) {
				if(this.id[i].name === _name) {
					this.current.animation = i;
					this.current.frame = 0;
					this.timer = 0;
				}
			}
		}
	};
	
	Animation.prototype.stop = function() {
		this.halt = true;
	};<commit_msg>Change animation speed per frame by speed per seconds<commit_after>Molecule.module('Molecule.Animation', function (require, p) {

	function Animation() {
		this.frame = new Array();
		this.id = new Array();
		this.current = {animation: 0, frame: 0};
		this.timer = 0;
		this.loop = true;
		this.reverse = false;
		this.halt = false;
	};
	
	// Method to get frames of the sprite sheet
	Animation.prototype.sliceFrames = function(_imageWidth, _imageHeight, _frameWidth, _frameHeight) {
		for(var i = 0; i < _imageHeight - 1; i += _frameHeight) {
			for(var j = 0; j < _imageWidth - 1; j += _frameWidth) {
				this.frame.push({x:j, y:i});
			}
		}
		if(_imageWidth === _frameWidth && _imageHeight === _frameHeight) {
			this.add('', [0], 60);
		}
	};
	
	// Method to add an animation
	Animation.prototype.add = function(_name, _frames, _speed) {
	    var _speedFps = _speed * 60 / _frames.length;
		this.id.push({name: _name, frame: _frames, speed: _speedFps});
	};
	
	//Method to play current animation
	Animation.prototype.run = function(_name, _loop, _reverse) {
	    _loop = _loop === undefined ? true : _loop;
	    _reverse = _reverse === undefined ? false : _reverse;
		this.loop = _loop;
		this.reverse = _reverse;
		this.halt = false;
		if(this.current.animation === -1 || this.id[this.current.animation].name !== _name) {
			this.current.frame = -1;
			for(var i = 0; i < this.id.length; i++) {
				if(this.id[i].name === _name) {
					this.current.animation = i;
					this.current.frame = 0;
					this.timer = 0;
				}
			}
		}
	};
	
	Animation.prototype.stop = function() {
		this.halt = true;
	};
{'fraction_non_alphanumeric': 0.15885750962772785, 'fraction_numerical': 0.010269576379974325, 'mean_word_length': 3.17828418230563, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5239697', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1064, 'n_words': 267}