天天看點

Fiori裡花瓣的動畫效果實作原理

SAP UI5

1217 篇文章25 訂閱

訂閱專欄

Fiori裡的busy dialog有兩種表現形式,一種是下圖裡的flower形狀,由5個花瓣組成。另一種是下圖的3/4個圓環的效果。

Fiori裡花瓣的動畫效果實作原理

關于前者的效果,可以看這個video。這個video是手動将default 300毫秒改成30秒之後的效果。

Fiori裡花瓣的動畫效果實作原理

(1). When it appeas in UI

According to callstack, the Flower-like animation, technically speaking, the BusyDialog will be opened every time there is change on url, which you could observe in address bar in your browser. This animation is implemented via in /sap/bc/ui5_ui5/ui2/ushell/resources/sap/m/BusyDialog.js

Fiori裡花瓣的動畫效果實作原理

(2). How is the Flower animation rendered

The entry point of rendering logic is in line 2019 below in file: /sap/bc/ui5_ui5/ui2/ushell/resources/sap/ui/core/Popup.js.

Fiori裡花瓣的動畫效果實作原理
Fiori裡花瓣的動畫效果實作原理

From here we know that the Flower we see in UI actually consists of FIVE ( why five? see line 97 below 😃 ) different div tag with well-prepared CSS class.

Fiori裡花瓣的動畫效果實作原理
Fiori裡花瓣的動畫效果實作原理

(3). When the Flower vanishes

There is a call in shell controller which will check whether the Flower busy dialog is still opened. If so, just put the close operation into the event queue with 0.3 second’s delay. It does not mean that the busy dialog will be closed after exactly 0.3 seconds due to Javascript’s single thread execution pattern.

Fiori裡花瓣的動畫效果實作原理

Also in the end of UI navigation, the UI framework will also attempt to close busy dialog if any.

Fiori裡花瓣的動畫效果實作原理

繼續閱讀