每幀動畫在 timer1_Tick 中繪製至緩衝區的 CurrentShownBitmap,隨後呈現於螢幕。
private GraphicsPath GetPageUnderGraphicsPath(int x, ref double a, int height, int width, bool isUnderSide, TurnType type)
x:頁面邊緣至熱點距離height/width:當前頁面顯示尺寸isUnderSide:是否計算 C 區域(翻動頁背面)type:左翻或右翻a(ref 參數):當前角度,繪製 C 區前用於旋轉座標isUnderSide 與 type 確保圖形路徑幾何正確性。
LoadSamples() 在 Sample 建構子中初始化。TickSpeed(毫秒)控制翻頁速度;熱點移動距離控制幀數;公開屬性控制已移動距離 x。HeightAdjustment 在控件頂部預留空白區域便於裁切。animateRightPageTurn() 與 animateLeftPageTurn()。嘗試解析 h = x * Tan(45 + (45 * x / PAGE_WIDTH)) 中 h = PAGE_HEIGHT 時的 x 值,採用暴力求解,代碼包含在原始碼中。是否有更優雅的解法?
原始碼下載:https://download.csdn.net/source/381727