Libraryless. Click here for Pure Java version (15443L/107K).
!7 sS imageID = #1006973; static int width = 200; module MouseHeart > DynEnabled { transient JWindow w; transient java.util.Timer timer; //*() { enabled = false; } start { update(); } void cleanMeUp { disposeWindow(w); } void update { print("update " + enabled); if (!enabled) { setVisible(w, false); cancelTimer(timer); timer = null; ret; } if (w == null) { BufferedImage img = loadBufferedImage(imageID); BufferedImage resized = resizeImage(img, width); w = showAnimation(resized); final Shape shape = scaleShape(alphaToShape(img), width/(double) img.getWidth()); swing { w.setShape(shape); } } setVisible(w, true); if (timer == null) timer = doEvery(20, r { setLocation(w, mouseX()+2, mouseY()+2) }); } }
Began life as a copy of #1006974
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: | #1020030 |
Snippet name: | Follow the mouse cursor with a heart [Dyn Module] |
Eternal ID of this version: | #1020030/8 |
Text MD5: | 5f974103f4bdcd83292b25463984ecec |
Transpilation MD5: | aec951a13c928946fd5712e343d0fc8a |
Author: | stefan |
Category: | javax / gui effects |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-12-04 16:03:00 |
Source code size: | 871 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 335 / 444 |
Version history: | 7 change(s) |
Referenced in: | [show references] |