<commit_before>(function(win){
	var Utils = win.Utils;
	var Sprite = win.Sprite;

	var MovieClip = win.MovieClip = function(x, y)
	{
		Sprite.call(this, x, y);

		this.time = 0;
		this.isPlay = false;
		this.isLoop = false;
		this.frameNum = 0;
		this.totalFrame = 0;
		this.data = {};
		this.action = "";
		this.frames = [];
		this.setFrameRate(24);
	};
	Utils.extends(MovieClip, Sprite);

	MovieClip.prototype.play = function(name, reset)
	{
		if(name != this.action || reset)
		{
			var data = this.data[name];

			this.action = name;
			this.frames = data.frames;
			this.totalFrame = data.frames.length;
			this.isLoop = data.loop;
			this.delay = data.delay||this.delay;
			this.frameNum = 0;
			this.time = 0;
			this._setFrame();
		}
		if(!this.isPlay)
		{
			this.time = 0;
			this.isPlay = true;
		}
	};

	MovieClip.prototype.stop = function(name)
	{
		if(name)
		{
			this.play(name);
		}
		this.isPlay = false;
	};

	MovieClip.prototype.addAnimation = function(name, frames, loop, frameRate)
	{
		if(typeof(frames) === "string")
		{
			var temp = frames.split("-");
			frames = [];
			for(var i = parseInt(temp[0]), l = parseInt(temp[1]);i <= l;i ++)
			{
				frames.push(i);
			}
		}
		
		var obj = {frames:frames, loop:loop||false};
		frameRate > 0 && (obj.delay = 1000/frameRate);
		this.data[name] = obj;
	};

	MovieClip.prototype.setFrameRate = function(frameRate)
	{
		this.frameRate = frameRate||24;
		this.delay = 1000/this.frameRate;
	};

	MovieClip.prototype._update = function()
	{
		this.time += this.timeStep;
		if(this.time >= this.delay)
		{
			this.time = this.time - this.delay;
			this.frameNum ++;
			if(this.frameNum >= this.totalFrame)
			{
				this.frameNum = 0;
				if(!this.isLoop) this.stop();
			}
			this._setFrame();
		}
	};

	MovieClip.prototype._draw = function(ctx)
	{
		if(this.img)
		{
			ctx.drawImage(this.img, this.sourceX, this.sourceY, this.width, this.height, -this.originX, -this.originY, this.width, this.height);
		}
		if(this.isPlay)
		{
			this._update();
		}
	};

	MovieClip.prototype._setFrame = function()
	{
		var num = this.frames[this.frameNum];
		this.sourceX = (num%this.col) * this.width;
		this.sourceY = (num/this.col>>0) * this.height;
	};
	<commit_msg>修改变量名<commit_after>(function(win){
	var Utils = win.Utils;
	var Sprite = win.Sprite;

	var MovieClip = win.MovieClip = function(x, y)
	{
		Sprite.call(this, x, y);

		this._time = 0;
		this.isPlay = false;
		this.isLoop = false;
		this.frameNum = 0;
		this.totalFrame = 0;
		this.data = {};
		this.action = "";
		this.frames = [];
		this.setFrameRate(24);
	};
	Utils.extends(MovieClip, Sprite);

	MovieClip.prototype.play = function(name, reset)
	{
		if(name != this.action || reset)
		{
			var data = this.data[name];

			this.action = name;
			this.frames = data.frames;
			this.totalFrame = data.frames.length;
			this.isLoop = data.loop;
			this.delay = data.delay||this.delay;
			this.frameNum = 0;
			this._time = 0;
			this._setFrame();
		}
		if(!this.isPlay)
		{
			this._time = 0;
			this.isPlay = true;
		}
	};

	MovieClip.prototype.stop = function(name)
	{
		if(name)
		{
			this.play(name);
		}
		this.isPlay = false;
	};

	MovieClip.prototype.addAnimation = function(name, frames, loop, frameRate)
	{
		if(typeof(frames) === "string")
		{
			var temp = frames.split("-");
			frames = [];
			for(var i = parseInt(temp[0]), l = parseInt(temp[1]);i <= l;i ++)
			{
				frames.push(i);
			}
		}
		
		var obj = {frames:frames, loop:loop||false};
		frameRate > 0 && (obj.delay = 1000/frameRate);
		this.data[name] = obj;
	};

	MovieClip.prototype.setFrameRate = function(frameRate)
	{
		this.frameRate = frameRate||24;
		this.delay = 1000/this.frameRate;
	};

	MovieClip.prototype._update = function()
	{
		this._time += this.timeStep;
		if(this._time >= this.delay)
		{
			this._time = this._time - this.delay;
			this.frameNum ++;
			if(this.frameNum >= this.totalFrame)
			{
				this.frameNum = 0;
				if(!this.isLoop) this.stop();
			}
			this._setFrame();
		}
	};

	MovieClip.prototype._draw = function(ctx)
	{
		if(this.img)
		{
			ctx.drawImage(this.img, this.sourceX, this.sourceY, this.width, this.height, -this.originX, -this.originY, this.width, this.height);
		}
		if(this.isPlay)
		{
			this._update();
		}
	};

	MovieClip.prototype._setFrame = function()
	{
		var num = this.frames[this.frameNum];
		this.sourceX = (num%this.col) * this.width;
		this.sourceY = (num/this.col>>0) * this.height;
	};
	
{'fraction_non_alphanumeric': 0.17428507092997073, 'fraction_numerical': 0.01035802747129025, 'mean_word_length': 3.0640439158279964, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '7350483', 'n_tokens_mistral': 1989, 'n_tokens_neox': 1718, 'n_words': 284}