-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not redraw continuous #2
Comments
Hi! Also I think recalculating all the state-values in update isn't always necessary. It should depend on whether the animation is playing or not. I'm just wondering how I would then detect mouseOver events (when different slices/segments are activated). frameRate(30) must go to setup(), obviously ;) Thanks! I'm doing some modifications on donut while preparing the launch of ASKKEN™ 1.0. Saving some cpu cycles on Donut drawing would help a lot there. ;) |
noLoop() should go in setup(), then processingjs doesn't call your draw function anymore. import("Tween.lib"); class MovingObject { public MovingObject(float x, float y, float tx, float ty) { public void update() { public int isPlaying() { public void draw() { public void restart() { MovingObject mo; void setup() { void animate() { void draw() { void mousePressed() { oh and these lines in your draw function: pushMatrix(); I really like the design of ASKKEN! It is really a nice way to browse for information. Looking forward to ASKKEN™ 1.0 ;) |
Thank you! Great ideas! I'll try to apply this approach to the current ASKKEN implementation and merge it back to DONUT when it's ready. However regarding ASKKEN, things seem to be a bit more difficult. The main reason why I'm redrawing all the time is, that nodes and edges in ASKKEN are organized by a particle system. That means nodes are likely to move around all the time (at least slowly to find their right place) which requires a redraw every iteration. Do you have an idea how I could come around that? Thank you so far :) |
Ehm, yeah that's more difficult. Maybe some options:
"I mean at least I can save performance when I skip update() (except for the x/y position update resulting from the particle system) if no animation is playing. However.. I'm not sure if I can save some draw iterations here" For the update thing I think you could use the same technique as described above, but then calling the update function. I don't know if it improves performance much because on update() it doesn't draw things, does it? Good luck :) |
By the way, to me seems option 3 the most plausible option + you could accelerate the process of stabilizing the donuts. |
Aii. Good thinking. I'll take that into consideration. Now I need some "particlesystemStableEnough?" detection, to turn it off when not needed. ;) What is your background Dan? Are you coming from the (native) Processing community? Do you have some sketches/examples online? In case you have, pls share them. :) |
Regarding update().... DONUT's update calculations are quite heavy. So that might be the cause for some frame drops -> needs to be tested. |
I am just a first year (so a couple of months) computer science student. I did some time ago experiments with processingjs just as an ebook (http://speechcorpus.googlepages.com/ebook.html) and a very simple window manager. Coming days I have probably no time to investigate further, maybe Thursday or weekend. Firebug (great tool!, can profile under console tab and then click profile and after a while again) reveals this: (donutsegment.draw()) 2435 16.8% 1937.867ms 7951.808ms 3.266ms 1.02ms 42.639ms 1 (line 225) (donutslice.draw()) 16558 15.83% 1826.078ms 4102.711ms 0.248ms 0.139ms 24.474ms 1 (line 92) arc 5222 12.16% 1403.095ms 1403.095ms 0.269ms 0.062ms 9.856ms processing.js (line 1628) array.size() 496350 8.26% 952.607ms 952.607ms 0.002ms 0.001ms 0.074ms processing.js (line 507) Donut.totalSlices() 29220 6.96% 802.435ms 1417.268ms 0.049ms 0.045ms 0.13ms 1 (line 379) stroke 22268 6.78% 781.988ms 1389.776ms 0.062ms 0.028ms 10.156ms line 16558 5.2% 600.285ms 600.285ms 0.036ms 0.023ms 8.199ms processing.js (line 1649) color 30996 4.82% 556.414ms 720.088ms 0.023ms 0ms According to Firebug the update function is this: (I've added the correct names, don't know why but Firebug was reporting array.clear instead of array.size). You could iterate faster (if you didn't know) over an array by the way by storing the length(s) of (an) array(s) before the for loop(s). That can help a little bit. |
Oh and one big deal: I think yo can remove those lines of Donutsegment.draw
does nothing :) |
found some time: |
Please redraw only on animation using noLoop() and own draw calls.
(smaller issue btw, please place frameRate(30) in your setup function instead of draw).
Hope you appreciate my comment.
The text was updated successfully, but these errors were encountered: