(window["webpackJsonp_name_"] = window["webpackJsonp_name_"] || []).push([[63,79],{ /***/ 180: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); __webpack_require__(417); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Counter = function () { _createClass(Counter, null, [{ key: 'default', get: function get() { return { elem: null, duration: 2000, count: 20 }; } }]); function Counter(params) { _classCallCheck(this, Counter); this._params = Object.assign({}, Counter.default, params); if (!this.elem) { return; } this.run(); } _createClass(Counter, [{ key: 'run', value: function run() { var _this = this; var number = this.elem.querySelector(Counter._counterNumber); if (!number) { return false; } var preCount = 0; Counter.animate({ duration: this.duration, timing: function timing(timeFraction) { return timeFraction; }, draw: function draw(progress) { var count = Math.floor(_this.count * progress); count = count < 0 ? 0 : count; if (preCount !== count) { requestAnimationFrame(function () { number.innerHTML = count.toString(); }); preCount = count; } } }); } }, { key: 'elem', get: function get() { return this._params.elem; } }, { key: 'duration', get: function get() { return this._params.duration; } }, { key: 'count', get: function get() { return this._params.count; } }], [{ key: 'animate', value: function animate(options) { var start = performance.now(); requestAnimationFrame(function animate(time) { // timeFraction от 0 до 1 var timeFraction = (time - start) / options.duration; if (timeFraction > 1) { timeFraction = 1; } // текущее состояние анимации var progress = options.timing(timeFraction); options.draw(progress); if (timeFraction < 1) { requestAnimationFrame(animate); } }); } }]); return Counter; }(); Object.defineProperty(Counter, '_counterNumber', { value: '.project-counter__number', enumerable: false, writable: false, configurable: false }); exports.default = Counter; /***/ }), /***/ 417: /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(436); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(167)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /***/ 436: /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(168)(false); // imports // module exports.push([module.i, ".project-counter{display:block}.project-counter.wpw-animate-box{opacity:0;transition:transform .6s ease,opacity .6s ease}.project-counter.wpw-animate-box.is-show{opacity:1;transform:translateY(0)}.project-counter__icon{display:inline-block;line-height:1}.project-counter__number,.project-counter__text{display:block}.project-counter__number:last-child{margin-bottom:0}.project-counter__icon-wrapper{display:inline-flex}.project-counter__icon-wrapper>span,.project-counter__icon-wrapper>span:first-child{flex:0 0 auto}.icon-placement-top{flex-direction:column}.icon-placement-bottom{flex-direction:column-reverse}.icon-placement-left{flex-direction:row;align-items:center}.icon-placement-right{flex-direction:row-reverse;align-items:center}", ""]); // exports /***/ }) }]);