<commit_before><!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>EaselJS Example: Infinite Hearts</title>

	<link href="assets/demoStyles.css" rel="stylesheet" type="text/css" />

	<script type="text/javascript" src="../lib/easeljs-NEXT.combined.js"></script>
	<!-- We also provide hosted minified versions of all CreateJS libraries.
	  http://code.createjs.com -->

	<script>
	var canvas;
	var stage;
	var container;
	var captureContainers;
	var captureIndex;

	function init() {
		// create a new stage and point it at our canvas:
		canvas = document.getElementById("testCanvas");
		stage = new createjs.Stage(canvas);

		var w = canvas.width;
		var h = canvas.height;

		container = new createjs.Container();
		stage.addChild(container);

		captureContainers = [];
		captureIndex = 0;

		// create a large number of slightly complex vector shapes, and give them random positions and velocities:
		for (var i=0; i<100; i++) {
			var heart = new createjs.Shape();
			heart.graphics.beginFill(createjs.Graphics.getHSL(Math.random()*30-45, 100, 50+Math.random()*30));
			heart.graphics.moveTo(0,-12).curveTo(1,-20,8,-20).curveTo(16,-20,16,-10).curveTo(16,0,0,12);
			heart.graphics.curveTo(-16,0,-16,-10).curveTo(-16,-20,-8,-20).curveTo(-1,-20,0,-12);
			heart.y = -100;

			container.addChild(heart);
		}

		var text = new createjs.Text("the longer I'm with you\nthe more I love you", "bold 24px Arial", "#312");
		text.textAlign = "center";
		text.x = w/2;
		text.y = h/2;
		stage.addChild(text);

		for (i=0; i<100; i++) {
			var captureContainer = new createjs.Container();
			captureContainer.cache(0,0,w,h);
			captureContainers.push(captureContainer);
		}

		// start the tick and point it at the window so we can do some work before updating the stage:
		createjs.Ticker.timingMode = createjs.Ticker.RAF;
		createjs.Ticker.addEventListener("tick", tick);
	}

	function tick(event) {
		var w = canvas.width;
		var h = canvas.height;
		var l = container.getNumChildren();

		captureIndex = (captureIndex+1)%captureContainers.length;
		stage.removeChildAt(0);
		var captureContainer = captureContainers[captureIndex];
		stage.addChildAt(captureContainer,0);
		captureContainer.addChild(container);

		// iterate through all the children and move them according to their velocity:
		for (var i=0; i<l; i++) {
			var heart = container.getChildAt(i);
			if (heart.y < -50) {
				heart._x = Math.random()*w;
				heart.y = h*(1+Math.random())+50;
				heart.perX = (1+Math.random()*2)*h;
				heart.offX = Math.random()*h;
				heart.ampX = heart.perX*0.1*(0.15+Math.random());
				heart.velY = -Math.random()*2-2;
				heart.scaleX = heart.scaleY = Math.random()+1;
				heart._rotation = Math.random()*40-20;
				heart.alpha = Math.random()*0.75+0.05;
			}
			var int = (heart.offX+heart.y)/heart.perX*Math.PI*2;
			heart.y += heart.velY;
			heart.x = heart._x + Math.cos(int)*heart.ampX;
			heart.rotation = heart._rotation + Math.sin(int)*30;<commit_msg>Playing with the Cache-vday example to make it nicer.<commit_after><!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>EaselJS Example: Infinite Hearts</title>

	<link href="assets/demoStyles.css" rel="stylesheet" type="text/css" />

	<script type="text/javascript" src="../lib/easeljs-NEXT.combined.js"></script>
	<!-- We also provide hosted minified versions of all CreateJS libraries.
	  http://code.createjs.com -->

	<script>
	var canvas;
	var stage;
	var container;
	var captureContainers;
	var captureIndex;

	function init() {
		// create a new stage and point it at our canvas:
		canvas = document.getElementById("testCanvas");
		stage = new createjs.Stage(canvas);

		var w = canvas.width;
		var h = canvas.height;

		container = new createjs.Container();
		stage.addChild(container);

		captureContainers = [];
		captureIndex = 0;

		// create a large number of slightly complex vector shapes, and give them random positions and velocities:
		for (var i=0; i<100; i++) {
			var heart = new createjs.Shape();
			heart.graphics.beginFill(createjs.Graphics.getHSL(Math.random()*30-45, 100, 50+Math.random()*30));
			heart.graphics.moveTo(0,-12).curveTo(1,-20,8,-20).curveTo(16,-20,16,-10).curveTo(16,0,0,12);
			heart.graphics.curveTo(-16,0,-16,-10).curveTo(-16,-20,-8,-20).curveTo(-1,-20,0,-12);
			heart.y = -100;

			container.addChild(heart);
		}

		var text = new createjs.Text("the longer I'm with you\nthe more I love you", "bold 24px Arial", "#312");
		text.textAlign = "center";
		text.x = w/2;
		text.y = h/2;
		stage.addChild(text);

		for (i=0; i<100; i++) {
			var captureContainer = new createjs.Container();
			captureContainer.cache(0,0,w,h);
			captureContainers.push(captureContainer);
		}

		// start the tick and point it at the window so we can do some work before updating the stage:
		createjs.Ticker.timingMode = createjs.Ticker.RAF;
		createjs.Ticker.addEventListener("tick", tick);
	}

	function tick(event) {
		var w = canvas.width;
		var h = canvas.height;
		var l = container.getNumChildren();

		captureIndex = (captureIndex+1)%captureContainers.length;
		stage.removeChildAt(0);
		var captureContainer = captureContainers[captureIndex];
		stage.addChildAt(captureContainer,0);
		captureContainer.addChild(container);

		// iterate through all the children and move them according to their velocity:
		for (var i=0; i<l; i++) {
			var heart = container.getChildAt(i);
			if (heart.y < -50) {
				heart._x = Math.random()*w;
				heart.y = h*(1+Math.random())+50;
				heart.perX = (1+Math.random()*2)*h;
				heart.offX = Math.random()*h;
				heart.ampX = heart.perX*0.1*(0.15+Math.random());
				heart.velY = -Math.random()*2-2;
				heart.scaleX = heart.scaleY = Math.random()*2+1;
				heart._rotation = Math.random()*40-20;
				heart.alpha = Math.random()*0.75+0.05;
				heart.compositeOperation = Math.random() < 0.33 ? "lighter" : "source-over";
			}
			var int = (heart.offX+heart.y)/heart.perX*Math.PI*2;
			heart.y += heart.velY*heart.scaleX/2;
			heart.x = heart._x + Math.cos(int)*heart.ampX;
			heart.rotation = heart._rotation + Math.sin(int)*30;
{'fraction_non_alphanumeric': 0.16314935064935066, 'fraction_numerical': 0.035876623376623375, 'mean_word_length': 3.9052547770700636, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 25, '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': '5596208', 'n_tokens_mistral': 2473, 'n_tokens_neox': 2136, 'n_words': 476}