Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- task TTestZoom(xZoomTarget,yZoomTarget){
- //The beginning camera zoom
- let xZoom = Get2DCameraRatioX();
- let yZoom = Get2DCameraRatioY();
- //The difference in current zoom and desired zoom
- let xZoomDiff = xZoomTarget - xZoom;
- let yZoomDiff = yZoomTarget - yZoom;
- //The current frame boundary
- let stgFrameLeft = GetStgFrameLeft();
- let stgFrameTop = GetStgFrameTop();
- let stgFrameWidth = GetStgFrameWidth();
- let stgFrameHeight = GetStgFrameHeight();
- let stgFrameRight = stgFrameLeft + stgFrameWidth;
- let stgFrameBottom = stgFrameTop + stgFrameHeight;
- //The current 2D camera x & y positions
- let cameraX = Get2DCameraX();
- let cameraY = Get2DCameraY();
- // Width and height of frame to be added/removed
- let stgFrameWidthDiff = stgFrameWidth/xZoomTarget - stgFrameWidth;
- let stgFrameHeightDiff = stgFrameHeight/yZoomTarget - stgFrameHeight;
- let rate = 120;
- WriteLog(rtoa(stgFrameLeft)~", "~rtoa(stgFrameTop)~", "~rtoa(stgFrameWidth)~", "~rtoa(stgFrameHeight));
- loop(rate){
- //Increments width and height by up the desired width and height
- stgFrameRight += stgFrameWidthDiff/rate;
- stgFrameBottom += stgFrameHeightDiff/rate;
- xZoom += xZoomDiff/rate;
- yZoom += yZoomDiff/rate;
- SetStgFrame(stgFrameLeft,stgFrameTop,stgFrameRight,stgFrameBottom,GetStgFrameRenderPriorityMinI(),GetStgFrameRenderPriorityMaxI());
- Set2DCameraRatioX(xZoom);
- Set2DCameraRatioY(yZoom);
- Set2DCameraFocusX(GetStgFrameWidth/2/xZoom);
- Set2DCameraFocusY(GetStgFrameHeight/2/yZoom);
- yield;
- }
- WriteLog(rtoa(stgFrameLeft)~", "~rtoa(stgFrameTop)~", "~rtoa(stgFrameWidth)~", "~rtoa(stgFrameHeight));
- WriteLog(rtoa(xZoom)~", "~rtoa(yZoom));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement