<commit_before><!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Example of firework.js</title>
<script src="fireworks-bundle.js"></script>
<script src="tquery-bundle.js"></script>

<script src="tquery.textureutils.js"></script>
</head>
<body style="margin: 0px; padding: 0px; overflow: hidden;">
<script>
  var world  = tQuery.createWorld().boilerplate().start();
  world.tRenderer().setClearColorHex( 0x000000, world.tRenderer().getClearAlpha() );

  world.removeCameraControls()
  world.tCamera().position.z  = 50;

  var container  = new THREE.Object3D();
  world.add(container)


  var urls  = [
    // "/img/flame00.png",
    //"/img/flame01.png",
    "/img/flame02.png",
    "/img/flame03.png",
    "/img/flame04.png",
    "/img/flame05.png",
    "/img/flame06.png",
    "/img/flame07.png",
    "/img/flame08.png",
    "/img/flame09.png",
    "/img/flame10.png",
    "/img/flame11.png",
    "/img/flame12.png",
    "/img/flame13.png",
    "/img/flame14.png",
    "/img/flame15.png",
    "/img/flame16.png",
    "/img/flame17.png",
    "/img/flame18.png",
    "/img/flame19.png",
    "/img/flame20.png",
    "/img/flame21.png",
    "/img/flame22.png",
    "/img/flame23.png",
    "/img/flame24.png"
  ];


  loadTremulousFlameParticule(urls, function(texture){
    //console.log("images", images)
    console.log("all images loaded");
  
    var emitter  = Fireworks.createEmitter({nParticles : 200})
      .bindTriggerDomEvents()
      .effectsStackBuilder()
        .spawnerSteadyRate(20)
        .position(Fireworks.createShapeSphere(0, 0,   0, 0.01))
        .velocity(Fireworks.createShapeSphere(0, 0, -30, 0.1))
        .lifeTime(1.5)
        .friction(0.98)
        .acceleration({
          effectId  : 'gravity',
          shape    : Fireworks.createShapePoint(0, 5, 0)
        })
        //.randomVelocityDrift(Fireworks.createVector(1,1,0))
        .randomVelocityDrift(Fireworks.createVector(0,0,9))
        .createEffect('scale', {
            origin  : 1/8,
            factor  : 1.005
          }).onBirth(function(particle){
            var object3d  = particle.get('threejsObject3D').object3d;
            var scale  = this.opts.origin;
            object3d.scale.set(scale, scale, scale)
          }).onUpdate(function(particle, deltaTime){
            var object3d  = particle.get('threejsObject3D').object3d;
            object3d.scale.multiplyScalar(this.opts.factor);
          }).back()
        .createEffect('rotation')
          .onBirth(function(particle){
            var object3d  = particle.get('threejsObject3D').object3d;
            object3d.rotation  = Math.random()*Math.PI*2;
          }).back()
        .renderToThreejsObject3D({
          container  : container,
          create    : function(){
            var object3d  = new THREE.Sprite({
              //color      : 0xffaacc,
              useScreenCoordinates  : false,
              map      : texture,
              blending    : THREE.AdditiveBlending,
              transparent    : true
            });
            object3d.opacity= 0.9;             
            object3d.uvScale.set(1, 1/urls.length)
            return object3d;
          }  
        })
        .createEffect("renderer")
          .onUpdate(function(particle, deltaTime){
            var object3d  = particle.get('threejsObject3D').object3d;
            var canonAge  = particle.get('lifeTime').normalizedAge();
            var imageIdx  = Math.floor(canonAge * (urls.length));
            var uvOffsetY  = imageIdx * 1/urls.length;
            object3d.uvOffset.set(0, uvOffsetY)
          }).back()

        .back()
      .start();

    // update the emitter in rendering loop
    world.loop().hook(function(delta, now){
      emitter.update(delta).render();
    })
    
    // bind 'mousemove' to control the flamethrower velocity
    document.body.addEventListener('mousemove', function(event){
      // get mouse coordinate in [-1, +1]
      var mouseX  = (event.clientX / window.innerWidth )*2 - 1;
      var mouseY  = (event.clientY / window.innerHeight)*2 - 1;
      
      // set velocity direction
      var angleY  = Math.PI - mouseX * Math.PI;
      var angleX  =           mouseY * Math.PI;
      var effect  = emitter.effect('velocity');
      var center  = effect.opts.shape.position.set(0, 0, 40);
      var matrix  = new THREE.Matrix4().makeRotationY(angleY).rotateX(angleX)
      matrix.multiplyVector3(center);

      // set gravity in local space
      var effect  = emitter.effect('gravity');
      var matrix  = container.matrixWorld.clone()
      					.setPosition({x:0,y:0,z:0}).transpose();
      var position  = effect.opts.shape.position.set(0, 20, 0);
      matrix.multiplyVector3(position);
    });
  });


  //////////////////////////////////////////////////////////////////////////
  //    misc helpers            //
  //////////////////////////////////////////////////////////////////////////
  function loadTremulousFlameParticule(urls, onReady){
    // load all the images from urls
    tQuery.TextureUtils.loadImages(urls, function(images, urls){
      // build a tiled spreadsheet canvas with images
      var canvas  = tQuery.TextureUtils.buildTiledSpriteSheet({
        images  : images,
        spriteW  : images[0].width,
        spriteH  : images[0].height,
        nSpriteX: 1
      });
      // create the texture
      var texture  = new THREE.Texture( canvas );
      texture.needsUpdate = true;
      // generate Alpha as it got no alpha 
      tQuery.TextureUtils.generateAlphaFromLuminance(texture, 16, 1);
      // notify caller
      onReady(texture, urls)
    })
  }
</script>

<canvas style="display: block;" height="933" width="1920"></canvas>


</body></html><commit_msg>Fix demos<commit_after><!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Example of firework.js</title>
<script src="fireworks-bundle.js"></script>
<script src="tquery-bundle.js"></script>

<script src="tquery.textureutils.js"></script>
</head>
<body style="margin: 0px; padding: 0px; overflow: hidden;">
<script>
  var world  = tQuery.createWorld().boilerplate().start();
  world.tRenderer().setClearColorHex( 0x000000, world.tRenderer().getClearAlpha() );

  world.removeCameraControls()
  world.tCamera().position.z  = 50;

  var container  = new THREE.Object3D();
  world.add(container)


  var urls  = [
    // "../img/flame00.png",
    //"../img/flame01.png",
    "../img/flame02.png",
    "../img/flame03.png",
    "../img/flame04.png",
    "../img/flame05.png",
    "../img/flame06.png",
    "../img/flame07.png",
    "../img/flame08.png",
    "../img/flame09.png",
    "../img/flame10.png",
    "../img/flame11.png",
    "../img/flame12.png",
    "../img/flame13.png",
    "../img/flame14.png",
    "../img/flame15.png",
    "../img/flame16.png",
    "../img/flame17.png",
    "../img/flame18.png",
    "../img/flame19.png",
    "../img/flame20.png",
    "../img/flame21.png",
    "../img/flame22.png",
    "../img/flame23.png",
    "../img/flame24.png"
  ];


  loadTremulousFlameParticule(urls, function(texture){
    //console.log("images", images)
    console.log("all images loaded");
  
    var emitter  = Fireworks.createEmitter({nParticles : 200})
      .bindTriggerDomEvents()
      .effectsStackBuilder()
        .spawnerSteadyRate(20)
        .position(Fireworks.createShapeSphere(0, 0,   0, 0.01))
        .velocity(Fireworks.createShapeSphere(0, 0, -30, 0.1))
        .lifeTime(1.5)
        .friction(0.98)
        .acceleration({
          effectId  : 'gravity',
          shape    : Fireworks.createShapePoint(0, 5, 0)
        })
        //.randomVelocityDrift(Fireworks.createVector(1,1,0))
        .randomVelocityDrift(Fireworks.createVector(0,0,9))
        .createEffect('scale', {
            origin  : 1/8,
            factor  : 1.005
          }).onBirth(function(particle){
            var object3d  = particle.get('threejsObject3D').object3d;
            var scale  = this.opts.origin;
            object3d.scale.set(scale, scale, scale)
          }).onUpdate(function(particle, deltaTime){
            var object3d  = particle.get('threejsObject3D').object3d;
            object3d.scale.multiplyScalar(this.opts.factor);
          }).back()
        .createEffect('rotation')
          .onBirth(function(particle){
            var object3d  = particle.get('threejsObject3D').object3d;
            object3d.rotation  = Math.random()*Math.PI*2;
          }).back()
        .renderToThreejsObject3D({
          container  : container,
          create    : function(){
            var object3d  = new THREE.Sprite({
              //color      : 0xffaacc,
              useScreenCoordinates  : false,
              map      : texture,
              blending    : THREE.AdditiveBlending,
              transparent    : true
            });
            object3d.opacity= 0.9;             
            object3d.uvScale.set(1, 1/urls.length)
            return object3d;
          }  
        })
        .createEffect("renderer")
          .onUpdate(function(particle, deltaTime){
            var object3d  = particle.get('threejsObject3D').object3d;
            var canonAge  = particle.get('lifeTime').normalizedAge();
            var imageIdx  = Math.floor(canonAge * (urls.length));
            var uvOffsetY  = imageIdx * 1/urls.length;
            object3d.uvOffset.set(0, uvOffsetY)
          }).back()

        .back()
      .start();

    // update the emitter in rendering loop
    world.loop().hook(function(delta, now){
      emitter.update(delta).render();
    })
    
    // bind 'mousemove' to control the flamethrower velocity
    document.body.addEventListener('mousemove', function(event){
      // get mouse coordinate in [-1, +1]
      var mouseX  = (event.clientX / window.innerWidth )*2 - 1;
      var mouseY  = (event.clientY / window.innerHeight)*2 - 1;
      
      // set velocity direction
      var angleY  = Math.PI - mouseX * Math.PI;
      var angleX  =           mouseY * Math.PI;
      var effect  = emitter.effect('velocity');
      var center  = effect.opts.shape.position.set(0, 0, 40);
      var matrix  = new THREE.Matrix4().makeRotationY(angleY).rotateX(angleX)
      matrix.multiplyVector3(center);

      // set gravity in local space
      var effect  = emitter.effect('gravity');
      var matrix  = container.matrixWorld.clone()
      					.setPosition({x:0,y:0,z:0}).transpose();
      var position  = effect.opts.shape.position.set(0, 20, 0);
      matrix.multiplyVector3(position);
    });
  });


  //////////////////////////////////////////////////////////////////////////
  //    misc helpers            //
  //////////////////////////////////////////////////////////////////////////
  function loadTremulousFlameParticule(urls, onReady){
    // load all the images from urls
    tQuery.TextureUtils.loadImages(urls, function(images, urls){
      // build a tiled spreadsheet canvas with images
      var canvas  = tQuery.TextureUtils.buildTiledSpriteSheet({
        images  : images,
        spriteW  : images[0].width,
        spriteH  : images[0].height,
        nSpriteX: 1
      });
      // create the texture
      var texture  = new THREE.Texture( canvas );
      texture.needsUpdate = true;
      // generate Alpha as it got no alpha 
      tQuery.TextureUtils.generateAlphaFromLuminance(texture, 16, 1);
      // notify caller
      onReady(texture, urls)
    })
  }
</script>

<canvas style="display: block;" height="933" width="1920"></canvas>


</body></html>
{'fraction_non_alphanumeric': 0.17084992210489874, 'fraction_numerical': 0.02804223645490739, 'mean_word_length': 2.0455983131259883, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, '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': '6250498', 'n_tokens_mistral': 3826, 'n_tokens_neox': 3625, 'n_words': 634}