403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/im/lib/animation/src/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/im/lib/animation/src/animation.js
/**
 * Bitrix Messenger
 * Animation manager
 *
 * @package bitrix
 * @subpackage im
 * @copyright 2001-2019 Bitrix
 */

class Animation
{
	static start(params)
	{
		let {
			start = 0,
			end = 0,
			increment = 20,
			callback = () => {},
			duration = 500,

			element,
			elementProperty
		} = params;

		let diff = end - start;
		let currentPosition = 0;

		const easeInOutQuad = function (current, start, diff, duration)
		{
			current /= duration/2;

			if (current < 1)
			{
				return diff / 2 * current * current + start;
			}

			current--;

			return -diff/2 * (current*(current-2) - 1) + start;
		};

		const requestFrame = (
			window.requestAnimationFrame
			|| window.webkitRequestAnimationFrame
			|| window.mozRequestAnimationFrame
			|| function(callback){return window.setTimeout(callback, 1000 / 60);}
		);

		let frameId = null;
		let animateScroll = () =>
		{
			currentPosition += increment;

			element[elementProperty] = easeInOutQuad(currentPosition, start, diff, duration);
			if (currentPosition < duration)
			{
				frameId = requestFrame(animateScroll);
			}
			else
			{
				if (callback && typeof callback === 'function')
				{
					callback();
				}
			}

			return frameId;
		};

		return animateScroll();
	}

	static cancel(id)
	{
		const cancelFrame = (
			window.cancelAnimationFrame
			|| window.webkitCancelAnimationFrame
			|| window.mozCancelAnimationFrame
			|| function(id){clearTimeout(id)}
		);

		cancelFrame(id);
	}
}

Animation.frameIds = {};

export {Animation};


Youez - 2016 - github.com/yon3zu
LinuXploit