<commit_before>var Splat = (function(splat, window, document) {

	function Animation() {
		this.frames = [];
		this.frame = 0;
		this.elapsedMillis = 0;
		this.repeatAt = 0;
		this.width = 0;
		this.height = 0;
	}
	Animation.prototype.add = function(img, time) {
		this.frames.push({img: img, time: time});
		if (frames.length === 0) {
			this.width = img.width;
			this.height = img.height;
		}
	};
	Animation.prototype.move = function(elapsedMillis) {
		this.elapsedMillis += elapsedMillis;
		while (this.elapsedMillis > this.frames[this.frame].time) {
			this.elapsedMillis -= this.frames[this.frame].time;
			this.frame++;
			if (this.frame >= this.frames.length) {
				this.frame = this.repeatAt;
			}
		}
	};
	Animation.prototype.draw = function(context, x, y) {
		var img = this.frames[this.frame].img;
		context.drawImage(img, x, y);
	};
	Animation.prototype.reset = function() {
		this.frame = 0;
		this.elapsedMillis = 0;
	};

	function makeFrame(img, frameWidth, f) {
		return splat.makeBuffer(frameWidth, img.height, function(ctx) {
			var sx = f * frameWidth;
			ctx.drawImage(img, sx, 0, frameWidth, img.height, 0, 0, frameWidth, img.height);
		});
	}
	function makeAnimation(img, numFrames, time) {
		var a = new Animation();
		var frameWidth = img.width / numFrames |0;
		for (var f = 0; f < numFrames; f++) {
			a.add(makeFrame(img, frameWidth, f), time);
		}
		return a;
	}

	function loadImagesFromManifest(imageLoader, manifest) {
		for (var key in manifest) {
			if (manifest.hasOwnProperty(key)) {
				var info = manifest[key];
				if (info.strip !== undefined) {
					imageLoader.load(key, info.strip);
				} else if (info.prefix !== undefined) {
					for (var i = 1; i <= info.frames; i++) {
						var name = info.prefix + i + info.suffix;
						imageLoader.load(key + i, name);
					}
				}
			}
		}
	}
	function AnimationLoader(imageLoader, manifest) {
		this.imageLoader = imageLoader;
		this.manifest = manifest;
		loadImagesFromManifest(imageLoader, manifest);
	}
	function makeAnimationFromManifest(images, key, manifestEntry) {
		if (manifestEntry.strip !== undefined) {
			var img = images.get(key);
			return makeAnimation(img, manifestEntry.frames, manifestEntry.msPerFrame);
		} else if (manifestEntry.prefix !== undefined) {
			var a = new Animation();
			for (var i = 1; i <= manifestEntry.frames; i++) {
				var img = images.get(key + i);
				a.add(img, manifestEntry.msPerFrame);
			}
			return a;
		}
	}
	function generateAnimationsFromManifest(images, manifest) {
		var animations = {};
		for (var key in manifest) {
			if (manifest.hasOwnProperty(key)) {
				var info = manifest[key];
				animations[key] = makeAnimationFromManifest(images, key, info);
			}
		}
		return animations;
	}
	AnimationLoader.prototype.allLoaded = function() {
		if (this.animations !== undefined) {
			return true;
		}
		var loaded = this.imageLoader.allLoaded();
		if (loaded) {
			this.animations = generateAnimationsFromManifest(this.imageLoader, this.manifest);
		}
		return loaded;
	};
	AnimationLoader.prototype.get = function(name) {
		return this.animations[name];
	}
<commit_msg>Support Animation repeatAt in manifest.<commit_after>var Splat = (function(splat, window, document) {

	function Animation() {
		this.frames = [];
		this.frame = 0;
		this.elapsedMillis = 0;
		this.repeatAt = 0;
		this.width = 0;
		this.height = 0;
	}
	Animation.prototype.add = function(img, time) {
		this.frames.push({img: img, time: time});
		if (frames.length === 0) {
			this.width = img.width;
			this.height = img.height;
		}
	};
	Animation.prototype.move = function(elapsedMillis) {
		this.elapsedMillis += elapsedMillis;
		while (this.elapsedMillis > this.frames[this.frame].time) {
			this.elapsedMillis -= this.frames[this.frame].time;
			this.frame++;
			if (this.frame >= this.frames.length) {
				this.frame = this.repeatAt;
			}
		}
	};
	Animation.prototype.draw = function(context, x, y) {
		var img = this.frames[this.frame].img;
		context.drawImage(img, x, y);
	};
	Animation.prototype.reset = function() {
		this.frame = 0;
		this.elapsedMillis = 0;
	};

	function makeFrame(img, frameWidth, f) {
		return splat.makeBuffer(frameWidth, img.height, function(ctx) {
			var sx = f * frameWidth;
			ctx.drawImage(img, sx, 0, frameWidth, img.height, 0, 0, frameWidth, img.height);
		});
	}
	function makeAnimation(img, numFrames, time) {
		var a = new Animation();
		var frameWidth = img.width / numFrames |0;
		for (var f = 0; f < numFrames; f++) {
			a.add(makeFrame(img, frameWidth, f), time);
		}
		return a;
	}

	function loadImagesFromManifest(imageLoader, manifest) {
		for (var key in manifest) {
			if (manifest.hasOwnProperty(key)) {
				var info = manifest[key];
				if (info.strip !== undefined) {
					imageLoader.load(key, info.strip);
				} else if (info.prefix !== undefined) {
					for (var i = 1; i <= info.frames; i++) {
						var name = info.prefix + i + info.suffix;
						imageLoader.load(key + i, name);
					}
				}
			}
		}
	}
	function AnimationLoader(imageLoader, manifest) {
		this.imageLoader = imageLoader;
		this.manifest = manifest;
		loadImagesFromManifest(imageLoader, manifest);
	}
	function makeAnimationFromManifest(images, key, manifestEntry) {
		var animation;
		if (manifestEntry.strip !== undefined) {
			var img = images.get(key);
			animation = makeAnimation(img, manifestEntry.frames, manifestEntry.msPerFrame);
		} else if (manifestEntry.prefix !== undefined) {
			animation = new Animation();
			for (var i = 1; i <= manifestEntry.frames; i++) {
				var img = images.get(key + i);
				animation.add(img, manifestEntry.msPerFrame);
			}
		}
		if (manifestEntry.repeatAt !== undefined) {
			animation.repeatAt = manifestEntry.repeatAt;
		}
		return animation;
	}
	function generateAnimationsFromManifest(images, manifest) {
		var animations = {};
		for (var key in manifest) {
			if (manifest.hasOwnProperty(key)) {
				var info = manifest[key];
				animations[key] = makeAnimationFromManifest(images, key, info);
			}
		}
		return animations;
	}
	AnimationLoader.prototype.allLoaded = function() {
		if (this.animations !== undefined) {
			return true;
		}
		var loaded = this.imageLoader.allLoaded();
		if (loaded) {
			this.animations = generateAnimationsFromManifest(this.imageLoader, this.manifest);
		}
		return loaded;
	};
	AnimationLoader.prototype.get = function(name) {
		return this.animations[name];
	}

{'fraction_non_alphanumeric': 0.1427675912866322, 'fraction_numerical': 0.004701457451810061, 'mean_word_length': 3.6246376811594203, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '3567045', 'n_tokens_mistral': 2444, 'n_tokens_neox': 2131, 'n_words': 480}