<commit_before><!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>Example</title>
	<link rel="stylesheet" href="../css/style.css">
	<script type="text/javascript">var root = '../../'</script>
	<script type="text/javascript" src="../../src/load.js"></script>
	<script type="text/paperscript" canvas="canvas">
		var balls = [],
			group = new Group(),
			circlePath = new Path.Circle([0, 0], 10),
			symbol = new Symbol(circlePath);
		circlePath.fillColor = new GradientColor(null, [0, 0], [0, 12], [0, 2]);
		circlePath.fillColor.gradient.type = 'radial';

		var Ball = Base.extend({
			initialize: function(point, vector) {
				if (!vector || vector.isZero()) {
					this.vector = Point.random() * 5;
				} else {
					this.vector = vector * 1.5;
				}
				this.point = point;
				this.dampen = 0.4;
				this.gravity = 3;
				this.bounce = -0.6;
				this.radius = 50 * Math.random() + 10;
				this.item = new PlacedSymbol(symbol);
				this.item.position = point;
				this.item.scale(this.radius / 10);
				group.appendTop(this.item);
			},

			iterate: function() {
				var size = document.size;
				this.vector.y += this.gravity;
				this.vector.x *= 0.99;
				var pre = this.point + this.vector;
				if (pre.x < this.radius || pre.x > size.width - this.radius)
					this.vector.x *= -this.dampen; 
				if (pre.y < this.radius || pre.y > size.height - this.radius) {
					if (Math.abs(this.vector.x) < 3)
						this.vector = Point.random() * [150, 100] + [-75, 20];
					this.vector.y *= this.bounce;
				}
				
				var max = Point.max(this.radius, this.point + this.vector);
				this.item.position = this.point = Point.min(max, size - this.radius);
			}
		});

		for (var i = 0; i < 10; i++) {
			var position = Point.random() * document.size,
				vector = (Point.random() - [0.5, 0]) * [50, 100],
				ball = new Ball(position, vector);
			balls.push(ball);<commit_msg>Rework Bouncing Balls example.<commit_after><!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>Example</title>
	<link rel="stylesheet" href="../css/style.css">
	<script type="text/javascript">var root = '../../'</script>
	<script type="text/javascript" src="../../src/load.js"></script>
	<script type="text/paperscript" canvas="canvas">
		var balls = [],
			group = new Group();

		var Ball = Base.extend({
			initialize: function(point, vector) {
				if (!vector || vector.isZero()) {
					this.vector = Point.random() * 5;
				} else {
					this.vector = vector * 1.5;
				}
				this.point = point;
				this.dampen = 0.4;
				this.gravity = 3;
				this.bounce = -0.6;
				this.radius = 50 * Math.random() + 30;
				this.item = new Path.Circle(point, this.radius);
				var color = new HSBColor(Math.random() * 360, 1, 1);
				var gradient = new Gradient([color, new RGBColor(0, 0, 0)], 'radial');
				this.item.fillColor = new GradientColor(gradient, point,
						point + this.radius, this.radius * 0.8);
				group.appendTop(this.item);
			},

			iterate: function() {
				var size = document.size;
				this.vector.y += this.gravity;
				this.vector.x *= 0.99;
				var pre = this.point + this.vector;
				if (pre.x < this.radius || pre.x > size.width - this.radius)
					this.vector.x *= -this.dampen; 
				if (pre.y < this.radius || pre.y > size.height - this.radius) {
					if (Math.abs(this.vector.x) < 3)
						this.vector = Point.random() * [150, 100] + [-75, 20];
					this.vector.y *= this.bounce;
				}
				
				var max = Point.max(this.radius, this.point + this.vector);
				this.item.position = this.point = Point.min(max, size - this.radius);
				this.item.rotate(this.vector.x / 2);
			}
		});

		for (var i = 0; i < 10; i++) {
			var position = Point.random() * document.size,
				vector = (Point.random() - [0.5, 0]) * [50, 100],
				ball = new Ball(position, vector);
			balls.push(ball);
{'fraction_non_alphanumeric': 0.18883457679444302, 'fraction_numerical': 0.025726781579624387, 'mean_word_length': 2.796875, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 31, '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': '955469', 'n_tokens_mistral': 1712, 'n_tokens_neox': 1364, 'n_words': 310}