Uses 911K of libraries. Click here for Pure Java version (2472L/13K).
1 | !7 |
2 | |
3 | cmodule MoveModulesEffect > DynSingleFunction { |
4 | transient L<Entry> entries; |
5 | transient int steps = 15, stepsBack = 5; |
6 | transient double sleepBetween = 2.0; |
7 | |
8 | sclass Entry { |
9 | S module; |
10 | Rect original; |
11 | Pt destiny; |
12 | } |
13 | |
14 | void doIt { |
15 | entries = synchroList(); |
16 | final int w = dm_desktopWidth(), mid = w/2, margin = 20; |
17 | try { |
18 | for (S module : dm_visibleModuleIDs()) { |
19 | Rect r = dm_frameRect(module); |
20 | if (r == null) continue; |
21 | bool goRight = r.x >= mid; |
22 | Pt destiny = pt(goRight ? w+margin : -margin-r.w, r.y); |
23 | entries.add(nu(Entry.class, +module, original := r, +destiny)); |
24 | } |
25 | for i to steps: { |
26 | moveThem(i, steps); |
27 | sleep(50); |
28 | } |
29 | sleepSeconds(sleepBetween); |
30 | for (int i = stepsBack-1; i > 0; i--) { |
31 | moveThem(i, stepsBack); |
32 | sleep(50); |
33 | } |
34 | } finally { |
35 | for (Entry e : entries) |
36 | dm_setBounds(e.module, e.original); |
37 | } |
38 | } |
39 | |
40 | void moveThem(final int i, final int steps) { |
41 | swing { |
42 | for (Entry e : entries) |
43 | dm_setBounds(e.module, |
44 | blend(e.original.x, e.destiny.x, doubleRatio(i, steps-1)), |
45 | blend(e.original.y, e.destiny.y, doubleRatio(i, steps-1)), |
46 | e.original.w, e.original.h); |
47 | } |
48 | } |
49 | } |
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1020962 |
Snippet name: | Move Modules Out Of Screen & Back Effect |
Eternal ID of this version: | #1020962/18 |
Text MD5: | ed2be1a772996d9d8a8bfc84adad5450 |
Transpilation MD5: | c58f201386dd9f1e50fc61c3742e03af |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-01-12 23:38:14 |
Source code size: | 1328 bytes / 49 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 396 / 1474 |
Version history: | 17 change(s) |
Referenced in: | [show references] |