<commit_before>local stage = emo.Stage();

const NUMBER_OF_SPARKS = 12;

class ParabolicMoveModifier extends emo.MultiModifier {
	g        = 0.0004;
	velocity = 0.2
	angle    = null;
	toY      = null;
	function constructor(_from, _angle, _duration, _startTime = null) {
		angle = emo.toRadian(_angle);
	
		local x = velocity * cos(angle) * _duration;
		local y = getY(velocity, angle, _duration, g);

		toY = y;
		
		base.constructor(_from, [_from[0] + x, _from[1] + y], _duration, [emo.easing.Linear, parabolic], 0, _startTime);
	}
	function onModify(currentValue) {
		targetObj.moveCenter(currentValue[0], currentValue[1]);
	}
	function getY(_velocity, _angle, _elapsed, _g) {
		return -(_velocity * sin(_angle) * _elapsed - (1 * 0.5 * _g * pow(_elapsed, 2)));
	}
	function parabolic(elapsed, duration, modifier) {
		local y = modifier.getY(modifier.velocity, modifier.angle, elapsed, modifier.g);
		return y / modifier.toY.tofloat();
	}
}

/*
 * This example shows single sprite that rotates and scales on touch-down event
 */
class Main {

	// 16x16 text sprite with 2 pixel border and 1 pixel margin
    text = emo.TextSprite("font_16x16.png",
		" !\"c*%#'{}@+,-./0123456789:;[|]?&ABCDEFGHIJKLMNOPQRSTUVWXYZ",
		16, 16, 2, 1);
		
    sparks = [];

	/*
	 * Called when this class is loaded
	 */
    function onLoad() {
        print("onLoad"); 
		for (local i = 0; i < NUMBER_OF_SPARKS; i++) {
			local spark = emo.Sprite("flare.png");
			spark.color(1, 1, 0);
			spark.hide();
			spark.load();
			sparks.append(spark);
		}
		
		// change the text
		text.setText("TAP TO ADD MODIFIERS");
		
		local tX = (stage.getWindowWidth()  - text.getScaledWidth())  / 2;
		text.move(tX, text.getScaledHeight());

		text.load();
		
		addSpark(stage.getCenterX(), stage.getCenterY());
    }

	/*
	 * Called when the app has gained focus
	 */
    function onGainedFocus() {
        print("onGainedFocus");
    }

	/*
	 * Called when the app has lost focus
	 */
    function onLostFocus() {
        print("onLostFocus"); 
    }

	/*
	 * Called when the class ends
	 */
    function onDispose() {
        print("onDispose");
    }
	
	function addSpark(startX, startY) {
		// save the start time of the modifiers because
		// there's a 'time lag' between the first modifier and the last modifier.
		local startTime = emo.Runtime().uptime();
		
		for (local i = 0; i < sparks.len(); i++) {
			
			sparks[i].moveCenter(startX, startY);
			
			// clear previous modifiers if exists.
			sparks[i].clearModifier();
			
			local angle = i * (360.0 / sparks.len());
			
			sparks[i].addModifier(ParabolicMoveModifier(
				[startX, startY],           // from [x, y]
				angle,                      // angle
				2000,                       // duration
				startTime                   // modifier start time
			));
				
			sparks[i].addModifier(emo.ColorModifier(
				[1, 1, 0],
				[0.7, 0.13, 0.13],
				2000,
				emo.easing.CubicIn,
				0,                          // repeat count
				startTime                   // modifier start time
				
			));
			sparks[i].addModifier(emo.AlphaModifier(
				1,
				0,
				2000,
				emo.easing.CubicIn,
				0,                          // repeat count
				startTime                   // modifier start time
			));
			sparks[i].addModifier(emo.RotateModifier(
				angle,
				angle + 180,
				2000,
				emo.easing.CubicOut,
				0,                          // repeat count
				startTime                   // modifier start time
			));
			sparks[i].show();
		}
	}

	/*
	 * touch event
	 */
	function onMotionEvent(mevent) {
		if (mevent.getAction() == MOTION_EVENT_ACTION_DOWN) {
			addSpark(mevent.getX(), mevent.getY());
		}
	}
}

function emo::onLoad() {
    stage.load(Main());
}
<commit_msg>update example parameter<commit_after>local stage = emo.Stage();

const NUMBER_OF_SPARKS = 12;

class ParabolicMoveModifier extends emo.MultiModifier {
	g        = 0.0005;
	velocity = 0.2;
	angle    = null;
	toY      = null;
	function constructor(_from, _angle, _duration, _startTime = null) {
		angle = emo.toRadian(_angle);
		
		local x = velocity * cos(angle) * _duration;
		local y = getY(velocity, angle, _duration, g);

		toY = y;
		
		base.constructor(_from, [_from[0] + x, _from[1] + y], _duration, [emo.easing.Linear, parabolic], 0, _startTime);
	}
	function onModify(currentValue) {
		targetObj.moveCenter(currentValue[0], currentValue[1]);
	}
	function getY(_velocity, _angle, _elapsed, _g) {
		return -(_velocity * sin(_angle) * _elapsed - (1 * 0.5 * _g * pow(_elapsed, 2)));
	}
	function parabolic(elapsed, duration, modifier) {
		local y = modifier.getY(modifier.velocity, modifier.angle, elapsed, modifier.g);
		return y / modifier.toY.tofloat();
	}
}

/*
 * This example shows single sprite that rotates and scales on touch-down event
 */
class Main {

	// 16x16 text sprite with 2 pixel border and 1 pixel margin
    text = emo.TextSprite("font_16x16.png",
		" !\"c*%#'{}@+,-./0123456789:;[|]?&ABCDEFGHIJKLMNOPQRSTUVWXYZ",
		16, 16, 2, 1);
		
    sparks = [];

	/*
	 * Called when this class is loaded
	 */
    function onLoad() {
        print("onLoad"); 
		for (local i = 0; i < NUMBER_OF_SPARKS; i++) {
			local spark = emo.Sprite("flare.png");
			spark.color(1, 1, 0);
			spark.hide();
			spark.load();
			sparks.append(spark);
		}
		
		// change the text
		text.setText("TAP TO ADD MODIFIERS");
		
		local tX = (stage.getWindowWidth()  - text.getScaledWidth())  / 2;
		text.move(tX, text.getScaledHeight());

		text.load();
		
		addSpark(stage.getCenterX(), stage.getCenterY());
    }

	/*
	 * Called when the app has gained focus
	 */
    function onGainedFocus() {
        print("onGainedFocus");
    }

	/*
	 * Called when the app has lost focus
	 */
    function onLostFocus() {
        print("onLostFocus"); 
    }

	/*
	 * Called when the class ends
	 */
    function onDispose() {
        print("onDispose");
    }
	
	function addSpark(startX, startY) {
		// save the start time of the modifiers because
		// there's a 'time lag' between the first modifier and the last modifier.
		local startTime = emo.Runtime().uptime();
		
		for (local i = 0; i < sparks.len(); i++) {
			
			sparks[i].moveCenter(startX, startY);
			
			// clear previous modifiers if exists.
			sparks[i].clearModifier();
			
			local angle = i * (360.0 / sparks.len());
			
			sparks[i].addModifier(ParabolicMoveModifier(
				[startX, startY],           // from [x, y]
				angle,                      // angle
				2000,                       // duration
				startTime                   // modifier start time
			));
				
			sparks[i].addModifier(emo.ColorModifier(
				[1, 1, 0],
				[0.7, 0.13, 0.13],
				2000,
				emo.easing.CubicIn,
				0,                          // repeat count
				startTime                   // modifier start time
				
			));
			sparks[i].addModifier(emo.AlphaModifier(
				1,
				0,
				2000,
				emo.easing.CubicIn,
				0,                          // repeat count
				startTime                   // modifier start time
			));
			sparks[i].addModifier(emo.RotateModifier(
				angle,
				angle + 180,
				2000,
				emo.easing.CubicOut,
				0,                          // repeat count
				startTime                   // modifier start time
			));
			sparks[i].show();
		}
	}

	/*
	 * touch event
	 */
	function onMotionEvent(mevent) {
		if (mevent.getAction() == MOTION_EVENT_ACTION_DOWN) {
			addSpark(mevent.getX(), mevent.getY());
		}
	}
}

function emo::onLoad() {
    stage.load(Main());
}

{'fraction_non_alphanumeric': 0.14066496163682865, 'fraction_numerical': 0.023960156144837798, 'mean_word_length': 2.3169642857142856, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6805649', 'n_tokens_mistral': 3089, 'n_tokens_neox': 2504, 'n_words': 596}