<commit_before>module.exports = class Dust extends Lysertron.Layer
  uniformAttrs:
    baseColor:     'c'
    size:          'f'
    particleAlpha: 'f'

  initialize: ->
    @direction = 1
    
    @size = THREE.Math.randFloat(3, 8)
    @position.z = Math.random()
    @scale.setLength 0

    @particleAlpha = THREE.Math.randFloat(0.4, 0.75)

    @baseColor = new THREE.Color().setHSV(
      THREE.Math.randFloat(0, 1)
      THREE.Math.randFloat(0, 0.25)
      1
    )

    @spin = new THREE.Vector3(
      THREE.Math.randFloatSpread(30).degToRad
      THREE.Math.randFloatSpread(30).degToRad
      THREE.Math.randFloatSpread(30).degToRad
    )

    @geom = new THREE.Geometry
    for i in [0..THREE.Math.randFloat(250, 1000)]
      @geom.vertices.push new THREE.Vector3(
        THREE.Math.randFloat(-1, 1)
        THREE.Math.randFloat(-1, 1)
        THREE.Math.randFloat(-1, 1)
      ).setLength THREE.Math.randFloat(4, 70)

    @particles = new THREE.ParticleSystem(
      @geom
      new THREE.ShaderMaterial(
        uniforms:       @uniforms
        vertexShader:   assets["vert.glsl"]
        fragmentShader: assets["frag.glsl"]
        transparent:    yes
        depthWrite:     no
      )
    )

    @add @particles

    @onBeat duration: 1

  onBeat: (beat) ->
    targetScale = if @direction > 0 then 1.5 else 0.75

    new TWEEN.Tween(@scale)<commit_msg>dust goes in and out at the same time<commit_after>module.exports = class Dust extends Lysertron.LayerStack
  initialize: ->
    @push new SingleDust()
    @push new SingleDust direction: -1

class SingleDust extends Lysertron.Layer
  uniformAttrs:
    baseColor:     'c'
    size:          'f'
    particleAlpha: 'f'

  initialize: (options = {}) ->
    @direction = options.direction || 1
    
    @size = THREE.Math.randFloat(3, 8)
    @position.z = Math.random()
    @scale.setLength 0

    @particleAlpha = THREE.Math.randFloat(0.3, 0.7)

    @baseColor = new THREE.Color().setHSV(
      THREE.Math.randFloat(0, 1)
      THREE.Math.randFloat(0, 0.25)
      1
    )

    @spin = new THREE.Vector3(
      THREE.Math.randFloatSpread(30).degToRad
      THREE.Math.randFloatSpread(30).degToRad
      THREE.Math.randFloatSpread(30).degToRad
    )

    @geom = new THREE.Geometry
    qty = THREE.Math.randInt(150, 600)
    console.log qty
    for i in [0..qty]
      @geom.vertices.push new THREE.Vector3(
        THREE.Math.randFloat(-1, 1)
        THREE.Math.randFloat(-1, 1)
        THREE.Math.randFloat(-1, 1)
      ).setLength THREE.Math.randFloat(4, 70)

    @particles = new THREE.ParticleSystem(
      @geom
      new THREE.ShaderMaterial(
        uniforms:       @uniforms
        vertexShader:   assets["vert.glsl"]
        fragmentShader: assets["frag.glsl"]
        transparent:    yes
        depthWrite:     no
      )
    )

    @add @particles

    @onBeat duration: 1

  onBeat: (beat) ->
    targetScale = if @direction > 0 then 1.5 else 0.75

    new TWEEN.Tween(@scale)
{'fraction_non_alphanumeric': 0.12119160460392688, 'fraction_numerical': 0.03215978334461747, 'mean_word_length': 2.265193370165746, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '4871389', 'n_tokens_mistral': 1119, 'n_tokens_neox': 1017, 'n_words': 210}