Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

49
LINES

< > BotCompany Repo | #1020962 // Move Modules Out Of Screen & Back Effect

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (2472L/13K).

!7

cmodule MoveModulesEffect > DynSingleFunction {
  transient L<Entry> entries;
  transient int steps = 15, stepsBack = 5;
  transient double sleepBetween = 2.0;
  
  sclass Entry {
    S module;
    Rect original;
    Pt destiny;
  }

  void doIt {
    entries = synchroList();
    final int w = dm_desktopWidth(), mid = w/2, margin = 20;
    try {
      for (S module : dm_visibleModuleIDs()) {
        Rect r = dm_frameRect(module);
        if (r == null) continue;
        bool goRight = r.x >= mid;
        Pt destiny = pt(goRight ? w+margin : -margin-r.w, r.y);
        entries.add(nu(Entry.class, +module, original := r, +destiny));
      }
      for i to steps: {
        moveThem(i, steps);
        sleep(50);
      }
      sleepSeconds(sleepBetween);
      for (int i = stepsBack-1; i > 0; i--) {
        moveThem(i, stepsBack);
        sleep(50);
      }
    } finally {
      for (Entry e : entries)
        dm_setBounds(e.module, e.original);
    }
  }
  
  void moveThem(final int i, final int steps) {
    swing {
      for (Entry e : entries)
        dm_setBounds(e.module,
          blend(e.original.x, e.destiny.x, doubleRatio(i, steps-1)),
          blend(e.original.y, e.destiny.y, doubleRatio(i, steps-1)),
          e.original.w, e.original.h);
    }
  }
}

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: 265 / 1345
Version history: 17 change(s)
Referenced in: [show references]