Commit 325c7d59 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander.Trofimov

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47561 954022d7-b5bf-4e40-9824-e11837661b57
parent 54ea9ff8
......@@ -328,7 +328,7 @@ function CTransitionAnimation(htmlpage)
var _ctx1 = oThis.HtmlPage.m_oEditor.HtmlElement.getContext('2d');
_ctx1.fillStyle = "#B0B0B0";
_ctx1.fillRect(0, 0, oThis.HtmlPage.m_oEditor.HtmlElement.width, oThis.HtmlPage.m_oEditor.HtmlElement.height);
}
}
var _xSrc = 0;
var _ySrc = 0;
......@@ -444,13 +444,13 @@ function CTransitionAnimation(htmlpage)
var _ctx1 = oThis.HtmlPage.m_oEditor.HtmlElement.getContext('2d');
_ctx1.fillStyle = "#B0B0B0";
_ctx1.fillRect(0, 0, oThis.HtmlPage.m_oEditor.HtmlElement.width, oThis.HtmlPage.m_oEditor.HtmlElement.height);
if (null != oThis.CacheImage2.Image)
if (null != oThis.CacheImage1.Image)
{
_ctx1.drawImage(oThis.CacheImage2.Image, oThis.Rect.x, oThis.Rect.y, oThis.Rect.w, oThis.Rect.h);
_ctx1.drawImage(oThis.CacheImage1.Image, oThis.Rect.x, oThis.Rect.y, oThis.Rect.w, oThis.Rect.h);
}
else
{
var _c = oThis.CacheImage2.Color;
var _c = oThis.CacheImage1.Color;
_ctx1.fillStyle = "rgb(" + _c.r + "," + _c.g + "," + _c.b + ")";
_ctx1.fillRect(oThis.Rect.x, oThis.Rect.y, oThis.Rect.w, oThis.Rect.h);
_ctx1.beginPath();
......@@ -468,46 +468,248 @@ function CTransitionAnimation(htmlpage)
oThis.HtmlPage.m_oOverlayApi.CheckRect(_xDst, _yDst, _wDst, _hDst);
var _ctx2 = oThis.HtmlPage.m_oOverlayApi.m_oContext;
_ctx2.setTransform(1,0,0,1,0,0);
var _koefWipeLen = 0.4;
var _koefWipeLen = 1;
switch (oThis.Param)
{
case c_oAscSlideTransitionParams.Param_Left:
{
_ctx2.save();
_ctx2.beginPath();
_ctx2.rect(_xDst, _yDst, _wDst, _hDst);
_ctx2.clip();
_ctx2.beginPath();
var _xPosStart = _xDst - _koefWipeLen * _wDst;
var _xPos = _xPosStart + (_part * (1 + _koefWipeLen) * _wDst);
var _gradW = _xPos - _xPosStart + _koefWipeLen * _wDst;
if (null == oThis.TimerId)
{
var _canvasTmp = document.createElement('canvas');
_canvasTmp.width = 256;
_canvasTmp.height = 1;
var _canvasTmpCtx = _canvasTmp.getContext('2d');
var _data = _canvasTmpCtx.createImageData(256, 1);
for (var i = 0; i < 256; i++)
_data.data[4 * i + 3] = 255 - i;
_canvasTmpCtx.putImageData(_data, 0, 0);
oThis.Params = { GradImage : _canvasTmp };
}
var _grad = _ctx2.createLinearGradient(_xDst, _yDst, _gradW, _yDst);
_grad.addColorStop(0, "rgba(0,0,0,255)");
_grad.addColorStop((_xPos - _xPosStart) / _gradW, "rgba(0,0,0,255)");
_grad.addColorStop(1, "rgba(0,0,0,0)");
var _xPosStart = (_xDst - _koefWipeLen * _wDst) >> 0;
var _xPos = (_xPosStart + (_part * (1 + _koefWipeLen) * _wDst)) >> 0;
var _gradW = (_koefWipeLen * _wDst) >> 0;
_ctx2.fillStyle = _grad;
_ctx2.beginPath();
_ctx2.fillRect(_xDst, _yDst, _gradW, _hDst);
_ctx2.beginPath();
if (_xPos > _xDst)
{
if ((_xPos + _gradW) > (_xDst + _wDst))
{
_ctx2.beginPath();
_ctx2.fillStyle = "#000000";
_ctx2.fillRect(_xDst, _yDst, _xPos - _xDst + 1, _hDst);
_ctx2.beginPath();
var _srcImageW = (256 * (_wDst - _xPos + _xDst) / _gradW) >> 0;
if (_srcImageW > 0 && (_wDst - _xPos + _xDst) > 0)
_ctx2.drawImage(oThis.Params.GradImage, 0, 0, _srcImageW, 1, _xPos, _yDst, _wDst - _xPos + _xDst, _hDst);
}
else
{
_ctx2.beginPath();
_ctx2.fillStyle = "#000000";
_ctx2.fillRect(_xDst, _yDst, _xPos - _xDst + 1, _hDst);
_ctx2.beginPath();
if (_gradW > 0)
{
_ctx2.drawImage(oThis.Params.GradImage, _xPos, _yDst, _gradW, _hDst);
}
}
}
else
{
var _srcImageW = _xPos + _gradW - _xDst;
var _srcImageWW = 256 * (_xPos + _gradW - _xDst) / _gradW;
_ctx2.restore();
if (_srcImageW > 0 && _srcImageWW > 0)
{
_ctx2.drawImage(oThis.Params.GradImage, 256 - _srcImageWW, 0, _srcImageWW, 1, _xDst, _yDst, _srcImageW, _hDst);
}
}
break;
}
case c_oAscSlideTransitionParams.Param_Right:
{
if (null == oThis.TimerId)
{
var _canvasTmp = document.createElement('canvas');
_canvasTmp.width = 256;
_canvasTmp.height = 1;
var _canvasTmpCtx = _canvasTmp.getContext('2d');
var _data = _canvasTmpCtx.createImageData(256, 1);
for (var i = 0; i < 256; i++)
_data.data[4 * i + 3] = i;
_canvasTmpCtx.putImageData(_data, 0, 0);
oThis.Params = { GradImage : _canvasTmp };
}
var _rDst = _xDst + _wDst;
var _xPosStart = (_rDst + _koefWipeLen * _wDst) >> 0;
var _xPos = (_xPosStart - (_part * (1 + _koefWipeLen) * _wDst)) >> 0;
var _gradW = (_koefWipeLen * _wDst) >> 0;
if (_xPos < _rDst)
{
if ((_xPos - _gradW) < _xDst)
{
_ctx2.beginPath();
_ctx2.fillStyle = "#000000";
_ctx2.fillRect(_xPos, _yDst, _rDst - _xPos, _hDst);
_ctx2.beginPath();
var _srcImageW = (256 * (_xDst - _xPos + _gradW) / _gradW) >> 0;
if (_srcImageW > 0 && (_xPos - _xDst) > 0)
_ctx2.drawImage(oThis.Params.GradImage, _srcImageW, 0, 256 - _srcImageW, 1, _xDst, _yDst, _xPos - _xDst, _hDst);
}
else
{
_ctx2.beginPath();
_ctx2.fillStyle = "#000000";
_ctx2.fillRect(_xPos, _yDst, _rDst - _xPos + 1, _hDst);
_ctx2.beginPath();
if (_gradW > 0)
{
_ctx2.drawImage(oThis.Params.GradImage, _xPos - _gradW, _yDst, _gradW, _hDst);
}
}
}
else
{
var _gradWW = _xPosStart - _xPos;
if (_gradWW > 0)
{
var _srcImageW = 256 * _gradWW / _gradW;
if (_srcImageW > 0 && (_rDst - _xPos + _gradW) > 0)
{
_ctx2.drawImage(oThis.Params.GradImage, 0, 0, _srcImageW, 1, _xPos - _gradW, _yDst, _rDst - _xPos + _gradW, _hDst);
}
}
}
break;
}
case c_oAscSlideTransitionParams.Param_Top:
{
if (null == oThis.TimerId)
{
var _canvasTmp = document.createElement('canvas');
_canvasTmp.width = 1;
_canvasTmp.height = 256;
var _canvasTmpCtx = _canvasTmp.getContext('2d');
var _data = _canvasTmpCtx.createImageData(1, 256);
for (var i = 0; i < 256; i++)
_data.data[4 * i + 3] = 255 - i;
_canvasTmpCtx.putImageData(_data, 0, 0);
oThis.Params = { GradImage : _canvasTmp };
}
var _yPosStart = (_yDst - _koefWipeLen * _hDst) >> 0;
var _yPos = (_yPosStart + (_part * (1 + _koefWipeLen) * _hDst)) >> 0;
var _gradH = (_koefWipeLen * _hDst) >> 0;
if (_yPos > _yDst)
{
if ((_yPos + _gradH) > (_yDst + _hDst))
{
_ctx2.beginPath();
_ctx2.fillStyle = "#000000";
_ctx2.fillRect(_xDst, _yDst, _wDst, _yPos - _yDst + 1);
_ctx2.beginPath();
var _srcImageH = (256 * (_hDst - _yPos + _yDst) / _gradH) >> 0;
if (_srcImageH > 0 && (_hDst - _yPos + _yDst) > 0)
_ctx2.drawImage(oThis.Params.GradImage, 0, 0, 1, _srcImageH, _xDst, _yPos, _wDst, _hDst - _yPos + _yDst);
}
else
{
_ctx2.beginPath();
_ctx2.fillStyle = "#000000";
_ctx2.fillRect(_xDst, _yDst, _wDst, _yPos - _yDst + 1);
_ctx2.beginPath();
if (_gradH > 0)
{
_ctx2.drawImage(oThis.Params.GradImage, _xDst, _yPos, _wDst, _gradH);
}
}
}
else
{
var _srcImageH = _yPos + _gradH - _yDst;
var _srcImageHH = 256 * (_yPos + _gradH - _yDst) / _gradH;
if (_srcImageH > 0 && _srcImageHH > 0)
{
_ctx2.drawImage(oThis.Params.GradImage, 0, 256 - _srcImageHH, 1, _srcImageHH, _xDst, _yDst, _wDst, _srcImageH);
}
}
break;
}
case c_oAscSlideTransitionParams.Param_Bottom:
{
if (null == oThis.TimerId)
{
var _canvasTmp = document.createElement('canvas');
_canvasTmp.width = 1;
_canvasTmp.height = 256;
var _canvasTmpCtx = _canvasTmp.getContext('2d');
var _data = _canvasTmpCtx.createImageData(1, 256);
for (var i = 0; i < 256; i++)
_data.data[4 * i + 3] = i;
_canvasTmpCtx.putImageData(_data, 0, 0);
oThis.Params = { GradImage : _canvasTmp };
}
var _bDst = _yDst + _hDst;
var _yPosStart = (_bDst + _koefWipeLen * _hDst) >> 0;
var _yPos = (_yPosStart - (_part * (1 + _koefWipeLen) * _hDst)) >> 0;
var _gradH = (_koefWipeLen * _hDst) >> 0;
if (_yPos < _bDst)
{
if ((_yPos - _gradH) < _yDst)
{
_ctx2.beginPath();
_ctx2.fillStyle = "#000000";
_ctx2.fillRect(_xDst, _yPos, _wDst, _bDst - _yPos);
_ctx2.beginPath();
var _srcImageH = (256 * (_yPos - _yDst) / _gradH) >> 0;
if (_srcImageH > 0 && (_yPos - _yDst) > 0)
_ctx2.drawImage(oThis.Params.GradImage, 0, 256 - _srcImageH, 1, _srcImageH, _xDst, _yDst, _wDst, _yPos - _yDst);
}
else
{
_ctx2.beginPath();
_ctx2.fillStyle = "#000000";
_ctx2.fillRect(_xDst, _yPos, _wDst, _bDst - _yPos);
_ctx2.beginPath();
if (_gradH > 0)
{
_ctx2.drawImage(oThis.Params.GradImage, _xDst, _yPos - _gradH, _wDst, _gradH);
}
}
}
else
{
var _srcImageH = _bDst - (_yPos - _gradH);
var _srcImageHH = 256 * _srcImageH / _gradH;
if (_srcImageH > 0 && _srcImageHH > 0)
{
_ctx2.drawImage(oThis.Params.GradImage, 0, 0, 1, _srcImageHH, _xDst, _bDst - _srcImageH, _wDst, _srcImageH);
}
}
break;
}
case c_oAscSlideTransitionParams.Param_TopLeft:
......@@ -531,25 +733,160 @@ function CTransitionAnimation(htmlpage)
}
_ctx2.globalCompositeOperation = "source-atop";
if (null != oThis.CacheImage1.Image)
if (null != oThis.CacheImage2.Image)
{
_ctx2.drawImage(oThis.CacheImage1.Image, _xDst, _yDst, _wDst, _hDst);
_ctx2.drawImage(oThis.CacheImage2.Image, _xDst, _yDst, _wDst, _hDst);
}
else
{
var _c = oThis.CacheImage1.Color;
var _c = oThis.CacheImage2.Color;
_ctx2.fillStyle = "rgb(" + _c.r + "," + _c.g + "," + _c.b + ")";
_ctx2.fillRect(_xDst, _yDst, _wDst, _hDst);
_ctx2.beginPath();
}
_ctx2.globalCompositeOperation = "source-over";
oThis.TimerId = __nextFrame(oThis._startWipe);
}
this._startSplit = function()
{
oThis.CurrentTime = new Date().getTime();
if (oThis.CurrentTime >= oThis.EndTime)
{
oThis.End(false);
return;
}
var _xDst = oThis.Rect.x;
var _yDst = oThis.Rect.y;
var _wDst = oThis.Rect.w;
var _hDst = oThis.Rect.h;
var _part = (oThis.CurrentTime - oThis.StartTime) / oThis.Duration;
oThis.HtmlPage.m_oOverlayApi.Clear();
oThis.HtmlPage.m_oOverlayApi.CheckRect(_xDst, _yDst, _wDst, _hDst);
var _ctx2 = oThis.HtmlPage.m_oOverlayApi.m_oContext;
_ctx2.setTransform(1,0,0,1,0,0);
var _koefWipeLen = 1;
switch (oThis.Param)
{
case c_oAscSlideTransitionParams.Split_VerticalIn:
{
if (oThis.TimerId === null)
{
// отрисовываем на основной канве картинку первого слайда
var _ctx1 = oThis.HtmlPage.m_oEditor.HtmlElement.getContext('2d');
_ctx1.fillStyle = "#B0B0B0";
_ctx1.fillRect(0, 0, oThis.HtmlPage.m_oEditor.HtmlElement.width, oThis.HtmlPage.m_oEditor.HtmlElement.height);
if (null != oThis.CacheImage1.Image)
{
_ctx1.drawImage(oThis.CacheImage1.Image, oThis.Rect.x, oThis.Rect.y, oThis.Rect.w, oThis.Rect.h);
}
else
{
var _c = oThis.CacheImage1.Color;
_ctx1.fillStyle = "rgb(" + _c.r + "," + _c.g + "," + _c.b + ")";
_ctx1.fillRect(oThis.Rect.x, oThis.Rect.y, oThis.Rect.w, oThis.Rect.h);
_ctx1.beginPath();
}
var _canvasTmp = document.createElement('canvas');
var __w = 256 + 255;
_canvasTmp.width = __w;
_canvasTmp.height = 1;
var _canvasTmpCtx = _canvasTmp.getContext('2d');
var _data = _canvasTmpCtx.createImageData(_canvasTmp.width, 1);
for (var i = 0; i < 256; i++)
_data.data[4 * i + 3] = i;
for (var i = 256; i < __w; i++)
_data.data[4 * i + 3] = __w - i - 1;
_canvasTmpCtx.putImageData(_data, 0, 0);
oThis.Params = { GradImage : _canvasTmp };
}
var _cX = _xDst + _wDst / 2;
if (_part <= 0.5)
{
var _w = (_part * 2 * _wDst) >> 0;
var _w2 = _w >> 1;
if (_w > 0 && _w2 > 0)
{
_ctx2.beginPath();
_ctx2.fillStyle = "#000000";
_ctx2.fillRect(Math.max(_xDst, _cX - _w2 / 2 - 1), _yDst, Math.min(_w2 + 2, _wDst), _hDst);
_ctx2.beginPath();
var _w4 = _w2 >> 1;
var _x = _cX - _w2;
var _r = _cX + _w4;
_ctx2.drawImage(oThis.Params.GradImage, 0, 0, 255, 1, _x, _yDst, _w4, _hDst);
_ctx2.drawImage(oThis.Params.GradImage, 255, 0, 255, 1, _r, _yDst, _w4, _hDst);
}
}
else
{
var _w = (_part * _wDst) >> 0;
var _w2 = _w >> 1;
_ctx2.beginPath();
_ctx2.fillStyle = "#000000";
_ctx2.fillRect(Math.max(_xDst, _cX - _w2 - 1), _yDst, Math.min(_w + 2, _wDst), _hDst);
_ctx2.beginPath();
var _gradWW = (_wDst - _w) >> 1;
var _gradW = (_wDst / 4) >> 0;
var _srcOff = 256 * _gradWW / _gradW;
if (_gradWW > 0)
{
//_ctx2.drawImage(oThis.Params.GradImage, 256 - _srcOff, 0, _srcOff, 1, _xDst, _yDst, _gradWW, _hDst);
//_ctx2.drawImage(oThis.Params.GradImage, 255, 0, _srcOff, 1, _cX + _w2, _yDst, _gradWW, _hDst);
_ctx2.drawImage(oThis.Params.GradImage, 0, 0, 255, 1, _xDst, _yDst, _gradWW, _hDst);
_ctx2.drawImage(oThis.Params.GradImage, 255, 0, 255, 1, _cX + _w2, _yDst, _gradWW, _hDst);
}
}
break;
}
case c_oAscSlideTransitionParams.Split_VerticalOut:
{
break;
}
case c_oAscSlideTransitionParams.Split_HorizontalIn:
{
break;
}
case c_oAscSlideTransitionParams.Split_HorizontalOut:
{
break;
}
default:
break;
}
_ctx2.globalCompositeOperation = "source-atop";
if (null != oThis.CacheImage2.Image)
{
_ctx2.drawImage(oThis.CacheImage2.Image, _xDst, _yDst, _wDst, _hDst);
}
else
{
var _c = oThis.CacheImage2.Color;
_ctx2.fillStyle = "rgb(" + _c.r + "," + _c.g + "," + _c.b + ")";
_ctx2.fillRect(_xDst, _yDst, _wDst, _hDst);
_ctx2.beginPath();
}
_ctx2.globalCompositeOperation = "source-over";
oThis.TimerId = __nextFrame(oThis._startSplit);
}
this._startUnCover = function()
......@@ -812,6 +1149,445 @@ function CTransitionAnimation(htmlpage)
this._startClock = function()
{
oThis.CurrentTime = new Date().getTime();
if (oThis.CurrentTime >= oThis.EndTime)
{
oThis.End(false);
return;
}
if (oThis.TimerId === null)
{
oThis.Params = { IsFirstAfterHalf : true };
// отрисовываем на основной канве картинку первого слайда
var _ctx1 = oThis.HtmlPage.m_oEditor.HtmlElement.getContext('2d');
_ctx1.fillStyle = "#B0B0B0";
_ctx1.fillRect(0, 0, oThis.HtmlPage.m_oEditor.HtmlElement.width, oThis.HtmlPage.m_oEditor.HtmlElement.height);
if (null != oThis.CacheImage1.Image)
{
_ctx1.drawImage(oThis.CacheImage1.Image, oThis.Rect.x, oThis.Rect.y, oThis.Rect.w, oThis.Rect.h);
}
else
{
var _c = oThis.CacheImage1.Color;
_ctx1.fillStyle = "rgb(" + _c.r + "," + _c.g + "," + _c.b + ")";
_ctx1.fillRect(oThis.Rect.x, oThis.Rect.y, oThis.Rect.w, oThis.Rect.h);
_ctx1.beginPath();
}
}
var _xDst = oThis.Rect.x;
var _yDst = oThis.Rect.y;
var _wDst = oThis.Rect.w;
var _hDst = oThis.Rect.h;
var _part = (oThis.CurrentTime - oThis.StartTime) / oThis.Duration;
oThis.HtmlPage.m_oOverlayApi.Clear();
oThis.HtmlPage.m_oOverlayApi.CheckRect(_xDst, _yDst, _wDst, _hDst);
var _anglePart1 = Math.atan(_wDst / _hDst);
var _anglePart2 = Math.PI / 2 - _anglePart1;
var _offset = 0;
var _ctx2 = oThis.HtmlPage.m_oOverlayApi.m_oContext;
oThis.HtmlPage.m_oOverlayApi.Clear();
oThis.HtmlPage.m_oOverlayApi.CheckRect(_xDst, _yDst, _wDst, _hDst);
_ctx2.save();
_ctx2.beginPath();
var _cX = _xDst + _wDst / 2;
var _cY = _yDst + _hDst / 2;
switch (oThis.Param)
{
case c_oAscSlideTransitionParams.Clock_Clockwise:
{
var _angle = 2 * Math.PI * _part;
var _x = 0;
var _y = 0;
var _mainPart = (2 * _angle / Math.PI) >> 0;
var _nomainPart = _angle - (_mainPart * Math.PI / 2);
switch (_mainPart)
{
case 0:
{
if (_nomainPart > _anglePart1)
{
_offset = _wDst * Math.tan((Math.PI / 2) - _nomainPart) / 2;
_x = _xDst + _wDst;
_y = _cY - _offset;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_cX, _yDst);
_ctx2.lineTo(_x, _yDst);
_ctx2.lineTo(_x, _y);
_ctx2.closePath();
}
else
{
_offset = _hDst * Math.tan(_nomainPart) / 2;
_x = _cX + _offset;
_y = _yDst;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_cX, _yDst);
_ctx2.lineTo(_x, _y);
_ctx2.closePath();
}
break;
}
case 1:
{
if (_nomainPart > _anglePart2)
{
_offset = _hDst * Math.tan((Math.PI / 2) - _nomainPart) / 2;
_x = _cX + _offset;
_y = _yDst + _hDst;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_cX, _yDst);
_ctx2.lineTo(_xDst + _wDst, _yDst);
_ctx2.lineTo(_xDst + _wDst, _yDst + _hDst);
_ctx2.lineTo(_x, _y);
_ctx2.closePath();
}
else
{
_offset = _wDst * Math.tan(_nomainPart) / 2;
_x = _xDst + _wDst;
_y = _cY + _offset;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_cX, _yDst);
_ctx2.lineTo(_x, _yDst);
_ctx2.lineTo(_x, _y);
_ctx2.closePath();
}
break;
}
case 2:
{
if (_nomainPart > _anglePart1)
{
_offset = _wDst * Math.tan((Math.PI / 2) - _nomainPart) / 2;
_x = _xDst;
_y = _cY + _offset;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_cX, _yDst);
_ctx2.lineTo(_xDst + _wDst, _yDst);
_ctx2.lineTo(_xDst + _wDst, _yDst + _hDst);
_ctx2.lineTo(_xDst, _yDst + _hDst);
_ctx2.lineTo(_x, _y);
_ctx2.closePath();
}
else
{
_offset = _hDst * Math.tan(_nomainPart) / 2;
_x = _cX - _offset;
_y = _yDst + _hDst;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_cX, _yDst);
_ctx2.lineTo(_xDst + _wDst, _yDst);
_ctx2.lineTo(_xDst + _wDst, _yDst + _hDst);
_ctx2.lineTo(_x, _y);
_ctx2.closePath();
}
break;
}
case 3:
{
if (_nomainPart > _anglePart2)
{
_offset = _hDst * Math.tan((Math.PI / 2) - _nomainPart) / 2;
_x = _cX - _offset;
_y = _yDst;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_cX, _yDst);
_ctx2.lineTo(_xDst + _wDst, _yDst);
_ctx2.lineTo(_xDst + _wDst, _yDst + _hDst);
_ctx2.lineTo(_xDst, _yDst + _hDst);
_ctx2.lineTo(_xDst, _yDst);
_ctx2.lineTo(_x, _y);
_ctx2.closePath();
}
else
{
_offset = _wDst * Math.tan(_nomainPart) / 2;
_x = _xDst;
_y = _cY - _offset;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_cX, _yDst);
_ctx2.lineTo(_xDst + _wDst, _yDst);
_ctx2.lineTo(_xDst + _wDst, _yDst + _hDst);
_ctx2.lineTo(_xDst, _yDst + _hDst);
_ctx2.lineTo(_x, _y);
_ctx2.closePath();
}
break;
}
}
break;
}
case c_oAscSlideTransitionParams.Clock_Counterclockwise:
{
var _angle = 2 * Math.PI * _part;
var _x = 0;
var _y = 0;
var _mainPart = (2 * _angle / Math.PI) >> 0;
var _nomainPart = _angle - (_mainPart * Math.PI / 2);
switch (_mainPart)
{
case 0:
{
if (_nomainPart > _anglePart1)
{
_offset = _wDst * Math.tan((Math.PI / 2) - _nomainPart) / 2;
_x = _xDst;
_y = _cY - _offset;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_cX, _yDst);
_ctx2.lineTo(_x, _yDst);
_ctx2.lineTo(_x, _y);
_ctx2.closePath();
}
else
{
_offset = _hDst * Math.tan(_nomainPart) / 2;
_x = _cX - _offset;
_y = _yDst;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_cX, _yDst);
_ctx2.lineTo(_x, _y);
_ctx2.closePath();
}
break;
}
case 1:
{
if (_nomainPart > _anglePart2)
{
_offset = _hDst * Math.tan((Math.PI / 2) - _nomainPart) / 2;
_x = _cX - _offset;
_y = _yDst + _hDst;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_cX, _yDst);
_ctx2.lineTo(_xDst, _yDst);
_ctx2.lineTo(_xDst, _yDst + _hDst);
_ctx2.lineTo(_x, _y);
_ctx2.closePath();
}
else
{
_offset = _wDst * Math.tan(_nomainPart) / 2;
_x = _xDst;
_y = _cY + _offset;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_cX, _yDst);
_ctx2.lineTo(_x, _yDst);
_ctx2.lineTo(_x, _y);
_ctx2.closePath();
}
break;
}
case 2:
{
if (_nomainPart > _anglePart1)
{
_offset = _wDst * Math.tan((Math.PI / 2) - _nomainPart) / 2;
_x = _xDst + _wDst;
_y = _cY + _offset;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_cX, _yDst);
_ctx2.lineTo(_xDst, _yDst);
_ctx2.lineTo(_xDst, _yDst + _hDst);
_ctx2.lineTo(_xDst + _wDst, _yDst + _hDst);
_ctx2.lineTo(_x, _y);
_ctx2.closePath();
}
else
{
_offset = _hDst * Math.tan(_nomainPart) / 2;
_x = _cX + _offset;
_y = _yDst + _hDst;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_cX, _yDst);
_ctx2.lineTo(_xDst, _yDst);
_ctx2.lineTo(_xDst, _yDst + _hDst);
_ctx2.lineTo(_x, _y);
_ctx2.closePath();
}
break;
}
case 3:
{
if (_nomainPart > _anglePart2)
{
_offset = _hDst * Math.tan((Math.PI / 2) - _nomainPart) / 2;
_x = _cX + _offset;
_y = _yDst;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_cX, _yDst);
_ctx2.lineTo(_xDst, _yDst);
_ctx2.lineTo(_xDst, _yDst + _hDst);
_ctx2.lineTo(_xDst + _wDst, _yDst + _hDst);
_ctx2.lineTo(_xDst + _wDst, _yDst);
_ctx2.lineTo(_x, _y);
_ctx2.closePath();
}
else
{
_offset = _wDst * Math.tan(_nomainPart) / 2;
_x = _xDst + _wDst;
_y = _cY - _offset;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_cX, _yDst);
_ctx2.lineTo(_xDst, _yDst);
_ctx2.lineTo(_xDst, _yDst + _hDst);
_ctx2.lineTo(_xDst + _wDst, _yDst + _hDst);
_ctx2.lineTo(_x, _y);
_ctx2.closePath();
}
break;
}
}
break;
}
case c_oAscSlideTransitionParams.Clock_Wedge:
{
var _angle = Math.PI * _part;
var _x = 0;
var _y = 0;
var _mainPart = (2 * _angle / Math.PI) >> 0;
var _nomainPart = _angle - (_mainPart * Math.PI / 2);
switch (_mainPart)
{
case 0:
{
if (_nomainPart > _anglePart1)
{
_offset = _wDst * Math.tan((Math.PI / 2) - _nomainPart) / 2;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_xDst, _cY - _offset);
_ctx2.lineTo(_xDst, _yDst);
_ctx2.lineTo(_xDst + _wDst, _yDst);
_ctx2.lineTo(_xDst + _wDst, _cY - _offset);
_ctx2.closePath();
}
else
{
_offset = _hDst * Math.tan(_nomainPart) / 2;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_cX - _offset, _yDst);
_ctx2.lineTo(_cX + _offset, _yDst);
_ctx2.closePath();
}
break;
}
case 1:
{
if (_nomainPart > _anglePart2)
{
_offset = _hDst * Math.tan((Math.PI / 2) - _nomainPart) / 2;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_cX - _offset, _yDst + _hDst);
_ctx2.lineTo(_xDst, _yDst + _hDst);
_ctx2.lineTo(_xDst, _yDst);
_ctx2.lineTo(_xDst + _wDst, _yDst);
_ctx2.lineTo(_xDst + _wDst, _yDst + _hDst);
_ctx2.lineTo(_cX + _offset, _yDst + _hDst);
_ctx2.closePath();
}
else
{
_offset = _wDst * Math.tan(_nomainPart) / 2;
_ctx2.moveTo(_cX, _cY);
_ctx2.lineTo(_xDst, _cY + _offset);
_ctx2.lineTo(_xDst, _yDst);
_ctx2.lineTo(_xDst + _wDst, _yDst);
_ctx2.lineTo(_xDst + _wDst, _cY + _offset);
}
break;
}
}
break;
}
default:
break;
}
_ctx2.clip();
if (_wDst > 0 && _hDst > 0)
{
if (null != oThis.CacheImage2.Image)
{
_ctx2.drawImage(oThis.CacheImage2.Image, _xDst, _yDst, _wDst, _hDst);
}
else
{
var _c = oThis.CacheImage2.Color;
_ctx2.fillStyle = "rgb(" + _c.r + "," + _c.g + "," + _c.b + ")";
_ctx2.fillRect(_xDst, _yDst, _wDst, _hDst);
_ctx2.beginPath();
}
}
_ctx2.restore();
oThis.TimerId = __nextFrame(oThis._startClock);
}
this._startZoom = function()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment