<commit_before>import Ember from "ember";
import Promise from "liquid-fire/promise";
var capitalize = Ember.String.capitalize;

export default Ember.Mixin.create({
  growDuration: 250,
  growPixelsPerSecond: 200,
  growEasing: 'slide',

  animateGrowth: function(elt, have, want) {
    return Promise.all([
      this._adaptDimension(elt, 'width', have, want),
      this._adaptDimension(elt, 'height', have, want)
    ]);
  },
  
  _adaptDimension: function(elt, dimension, have, want) {
    var target = {};
    target[dimension] = [
      want['literal'+capitalize(dimension)],
      have['literal'+capitalize(dimension)],
    ];
    return Ember.$.Velocity(elt[0], target, {
      duration: this._durationFor(have[dimension], want[dimension]),
      queue: false,
      easing: this.get('growEasing')      
    });
  },

  _durationFor: function(before, after) {
    return Math.min(this.get('growDuration'), 1000*Math.abs(before - after)/this.get('growPixelsPerSecond'));
  }
  
});<commit_msg>add growth animations to the running transition count<commit_after>import Ember from "ember";
import Promise from "liquid-fire/promise";
var capitalize = Ember.String.capitalize;

export default Ember.Mixin.create({
  growDuration: 250,
  growPixelsPerSecond: 200,
  growEasing: 'slide',

  transitionMap: Ember.inject.service('liquid-fire-transitions'),

  animateGrowth: function(elt, have, want) {
    this.transitionMap.activeCount++;
    return Promise.all([
      this._adaptDimension(elt, 'width', have, want),
      this._adaptDimension(elt, 'height', have, want)
    ]).then(()=>{
      this.transitionMap.activeCount--;
    });
  },

  _adaptDimension: function(elt, dimension, have, want) {
    var target = {};
    target[dimension] = [
      want['literal'+capitalize(dimension)],
      have['literal'+capitalize(dimension)],
    ];
    return Ember.$.Velocity(elt[0], target, {
      duration: this._durationFor(have[dimension], want[dimension]),
      queue: false,
      easing: this.get('growEasing')
    });
  },

  _durationFor: function(before, after) {
    return Math.min(this.get('growDuration'), 1000*Math.abs(before - after)/this.get('growPixelsPerSecond'));
  }

});
{'fraction_non_alphanumeric': 0.15289821999087175, 'fraction_numerical': 0.010041077133728891, 'mean_word_length': 4.016018306636155, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '1499500', 'n_tokens_mistral': 734, 'n_tokens_neox': 675, 'n_words': 134}