<commit_before>var TweetConstellation = (function() {
  'use strict';

  function randInt(min,max){
    var range = max - min;
    // it actually does work the other way...
    // if (range < 0) { throw new RangeError("min must be less than max"); }

    var rand = Math.floor(Math.random() * (range + 1));
    return min + rand;
  }

  function parseTweet(tweet) {
    return {
      id: tweet.id_str,
      contentType: ['text', 'photo', 'video'][randInt(0, 2)],
      is_retweet: tweet.retweeted_status !== undefined,
      original_id: (tweet.retweeted_status !== undefined) ? tweet.retweeted_status.id_str : null,
      retweeted_status: tweet.retweeted_status,
      original: tweet
    };
  }

  function TweetParticle(tweet, sprite) {
    this._listeners = [];

    this.tweet = tweet;
    this.retweetCount = 0;
    this.sprite = sprite;

    sprite.position.set( Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5 );
    sprite.position.setLength( Parameters.SphereRadius * (Math.random() * 0.1 + 0.9) );

    this.startPosition = sprite.position.clone()
    this.randomness = Math.random();

    this.setTexture(sprite);
    this.setSpriteColor(sprite);
    this.computeScale();

    sprite.scale.set(this.scale, this.scale, 1.0 ); // imageWidth, imageHeight
    sprite.visible = true;

    this.age = 0;
    this.maxAge = Parameters.TweetLife;
  }

  TweetParticle.prototype.setTexture = function(sprite) {
    var texture = Textures[this.tweet.contentType];

    sprite.material.map = texture;
    sprite.material.needsUpdate = true;
  };

  TweetParticle.prototype.setSpriteColor = function(sprite) {
    var hueMap = {
      'text': Parameters.textHue,
      'photo': Parameters.photoHue,
      'video': Parameters.videoHue
    };

    var hue = hueMap[this.tweet.contentType];

    //hue = this.tweet.is_retweet? 0.5 : 0.9;

    //sprite.material.color.setHSL( Math.random(), 0.9, 0.7 );
    sprite.opacity = 0.50; // translucent particles color
    sprite.material.color.setHSL(hue, 0.9, 0.7 );
    //sprite.material.NoColor;
  };

  TweetParticle.prototype.update = function(dt) {
    this.age += dt;

    this.sprite.scale.set(this.scale, this.scale, 1.0 ); // imageWidth, imageHeight

    var a = this.randomness + 1;
    var pulseFactor = Math.sin(a * Parameters.PulseFactor * this.age) * 0.1 + 0.9;
    this.sprite.position.x = this.startPosition.x * pulseFactor;
    this.sprite.position.y = this.startPosition.y * pulseFactor;
    this.sprite.position.z = this.startPosition.z * pulseFactor;


    if (this.age >= this.maxAge) {
      this.sprite.visible = false;
    }
    return this.age >= this.maxAge;
  };

  TweetParticle.prototype.addRetweet = function(retweet) {
    this.retweetCount++;
    this.maxAge += Parameters.RTAgeIncrease;
    this.computeScale()

  };

  var sizeScale = d3.scale.sqrt().domain([0, 10]).range([32*2, 32*4])

  TweetParticle.prototype.computeScale = function() {
    this.scale = sizeScale(this.retweetCount);
  };

  TweetParticle.prototype.toString = function() {
    return "{tweet: " + this.tweet.id + " , retweets: " + this.retweetCount + ",age: " + this.age + ", maxAge: " + this.maxAge + "}";
  };

  function TweetConstellation(scene) {
    this.maxTweets = Parameters.MaxSupportedTPS * Parameters.TweetLife;

    this.particleGroup = null;

    this.scene = scene;
  }


  var Textures = {
    'text': THREE.ImageUtils.loadTexture( 'images/spark-01.svg' ),
    'photo': THREE.ImageUtils.loadTexture( 'images/spark-02.svg' ),
    'video': THREE.ImageUtils.loadTexture( 'images/spark-03.svg' )
  };

  TweetConstellation.prototype.initParticlesPool = function() {
    this.particleGroup = new THREE.Object3D();
    this.particlesPool = [];
    for (var i=0; i < this.maxTweets; i++) {
      var spriteMaterial = new THREE.SpriteMaterial( { map: Textures['text'], useScreenCoordinates: false, color: 0xff0000 } );
      var sprite = new THREE.Sprite( spriteMaterial );
      sprite.visible = false;

      this.particleGroup.add(sprite);
      this.particlesPool.push(sprite);
    }
    this.particleGroup.position.y = 100;
    this.scene.add(this.particleGroup);<commit_msg>formato en particulas opacity + color random<commit_after>var TweetConstellation = (function() {
  'use strict';

  function randInt(min,max){
    var range = max - min;
    // it actually does work the other way...
    // if (range < 0) { throw new RangeError("min must be less than max"); }

    var rand = Math.floor(Math.random() * (range + 1));
    return min + rand;
  }

  function parseTweet(tweet) {
    return {
      id: tweet.id_str,
      contentType: ['text', 'photo', 'video'][randInt(0, 2)],
      is_retweet: tweet.retweeted_status !== undefined,
      original_id: (tweet.retweeted_status !== undefined) ? tweet.retweeted_status.id_str : null,
      retweeted_status: tweet.retweeted_status,
      original: tweet
    };
  }

  function TweetParticle(tweet, sprite) {
    this._listeners = [];

    this.tweet = tweet;
    this.retweetCount = 0;
    this.sprite = sprite;

    sprite.position.set( Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5 );
    sprite.position.setLength( Parameters.SphereRadius * (Math.random() * 0.1 + 0.9) );

    this.startPosition = sprite.position.clone()
    this.randomness = Math.random();

    this.setTexture(sprite);
    this.setSpriteColor(sprite);
    this.computeScale();

    sprite.scale.set(this.scale, this.scale, 1.0 ); // imageWidth, imageHeight
    sprite.visible = true;

    this.age = 0;
    this.maxAge = Parameters.TweetLife;
  }

  TweetParticle.prototype.setTexture = function(sprite) {
    var texture = Textures[this.tweet.contentType];


    sprite.material.map = texture;
    sprite.material.needsUpdate = true;

    //sprite.material.color.setHSL( Math.random(), 0.9, 0.7 );
    sprite.material.opacity = Math.random(); // translucent particles color
    sprite.material.color.setHSL(Math.random(), 0.9, 0.8 );
    //sprite.material.NoColor;
  };

  TweetParticle.prototype.setSpriteColor = function(sprite) {
    var hueMap = {
      'text': Parameters.textHue,
      'photo': Parameters.photoHue,
      'video': Parameters.videoHue
    };

    var hue = hueMap[this.tweet.contentType];

    //hue = this.tweet.is_retweet? 0.5 : 0.9;

    //sprite.material.color.setHSL( Math.random(), 0.9, 0.7 );
    sprite.opacity = 0.50; // translucent particles color
    sprite.material.color.setHSL(hue, 0.9, 0.7 );
    //sprite.material.NoColor;
  };

  TweetParticle.prototype.update = function(dt) {
    this.age += dt;

    this.sprite.scale.set(this.scale, this.scale, 1.0 ); // imageWidth, imageHeight

    var a = this.randomness + 1;
    var pulseFactor = Math.sin(a * Parameters.PulseFactor * this.age) * 0.1 + 0.9;
    this.sprite.position.x = this.startPosition.x * pulseFactor;
    this.sprite.position.y = this.startPosition.y * pulseFactor;
    this.sprite.position.z = this.startPosition.z * pulseFactor;


    if (this.age >= this.maxAge) {
      this.sprite.visible = false;
    }
    return this.age >= this.maxAge;
  };

  TweetParticle.prototype.addRetweet = function(retweet) {
    this.retweetCount++;
    this.maxAge += Parameters.RTAgeIncrease;
    this.computeScale()

  };

  var sizeScale = d3.scale.sqrt().domain([0, 10]).range([32*2, 32*4])

  TweetParticle.prototype.computeScale = function() {
    this.scale = sizeScale(this.retweetCount);
  };

  TweetParticle.prototype.toString = function() {
    return "{tweet: " + this.tweet.id + " , retweets: " + this.retweetCount + ",age: " + this.age + ", maxAge: " + this.maxAge + "}";
  };

  function TweetConstellation(scene) {
    this.maxTweets = Parameters.MaxSupportedTPS * Parameters.TweetLife;

    this.particleGroup = null;
    this.scene = scene;
  }


  var Textures = {
    'text': THREE.ImageUtils.loadTexture( 'images/spark-01.svg' ),
    'photo': THREE.ImageUtils.loadTexture( 'images/spark-02.svg' ),
    'video': THREE.ImageUtils.loadTexture( 'images/spark-03.svg' )
  };

  TweetConstellation.prototype.initParticlesPool = function() {
    this.particleGroup = new THREE.Object3D();
    this.particlesPool = [];
    for (var i=0; i < this.maxTweets; i++) {
      var spriteMaterial = new THREE.SpriteMaterial( { map: Textures['text'], useScreenCoordinates: false, color: 0xff0000, transparent: true, opacity: 0.5} );
      var sprite = new THREE.Sprite( spriteMaterial );
      sprite.visible = false;

      this.particleGroup.add(sprite);
      this.particlesPool.push(sprite);
    }
    this.particleGroup.position.y = 100;
    this.scene.add(this.particleGroup);
{'fraction_non_alphanumeric': 0.14801023970211777, 'fraction_numerical': 0.016523155690016292, 'mean_word_length': 3.1322115384615383, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4601804', 'n_tokens_mistral': 3108, 'n_tokens_neox': 2882, 'n_words': 531}