I have a few animations being fired from a mouseenter event. Works just fine the first time around and then when I attempt to fire the animation again it gets to the beginAnimation function on the aframe-animation-component, which means it should emitting the animationbegin event but at that point nothing happens and the complete function in the config object never ends up running like it does when the animation runs fine the first time. Trying to figure out what parts I should be looking at to debug this but I'm having a hard time. Thanks! Also, I'm using the newest version off of kframe repo.
Related
I was wondering if anyone else was having the same problems and if there are any solutions out there...
I've created an app using Material-UI and Meteor JS. All was well until I updated Material-UI to v5, where they totally changed how components were styled, now they are using #emotion.
I'm now getting a lot of noticeable performance issues with certain components on first use. And a lot of warnings in the console along the lines of "[Violation] 'foobar' handler took xxxxms".
For example, if you have a Material-UI Dialog that is popped up by clicking a button, then the first time that dialog is popped up, it can take 1-3 seconds. Subsequent pop-ups are 'instant'. If you force-reload the page, then again, on first use, you get the performance issue.
I wondered if it was something to do with the complexity of my app or some odd interaction, so I just created a brand new Meteor project (the default React one that has a button that increments a counter), installed Material-UI v5.0.6 and then replaced the button on the default app with a Material-UI component.
Immediately, I get console warnings about performance issues. In this case a warning about DOMContentLoaded taking too long on page load, then one when I click the button 'mousedown' handler took 300ms.
Opening up Chrome's Performance doo-dar, I see a first click takes around 300ms and LOTS of things are going on under the hood in emotion. One subsequent clicks, very little is going on under the hood and the event is around 3ms, ie, 100x quicker.
Any thoughts on this out there?
I have a component that is using React Transition Group to animate a component as it changes from one component to the next.
The problem I am having is that the next component is loading before the current animation is finished, so it looks a bit odd.
I think i could solve this if it were possible to delay the render() method when the component updates, as it never really unmounts, and this is why the component flashes the next image.
there is FAR too much code involved to paste it all here so i made my github public, and created an issue there to show what I am experiencing.
also you can view the site as it is live for this debugging session.
stevensheaves.me
Also, no judgy, its not 100% finished.
You can simply use the callback of the Transition Group namely onEntered.
A callback fired immediately after the 'enter' or 'appear' classes are removed and the done class is added to the DOM node.
You can use a flag variable to display your content. Set it to true when the callback is fired and to false when it's onEntering
I have a button widget I'd like to fade out (self.button1)
def button_slot(self):
fade_effect = QtGui.QGraphicsOpacityEffect()
self.button1.setGraphicsEffect(fade_effect)
hideAnimation = QtCore.QPropertyAnimation(fade_effect, "opacity")
hideAnimation.setDuration(5000)
hideAnimation.setStartValue(1.0)
hideAnimation.setEndValue(0.0)
hideAnimation.start(QtCore.QPropertyAnimation.DeleteWhenStopped)
self.hideAnimation = hideAnimation
The code is in PyQt, but is the same as the original Qt.
For a reason, the when I try the code separately in a test file, it works well.
However, when trying to integrate it in my code, it seems like the fading out animation is running in the background, but not updated in the GUI itself:
The button is stuck at the "clicked" state.
If I minimize and enlarge the window, The button's opacity is right where it's supposed to be (for example, if the duration is 5000ms from 1.0 to 0.0, enlarging the window after 2500ms will show 0.5 opacity).
The button is clickable even though it looks "stuck".
Why could this be happening? How can I force the GUI to update itself at every event iteration?
The only possible explanation I have is that you're blocking the event loop somewhere else in your code. The animation will definitely run, as your test case shows, but it's invoked from the event loop. If your code blocks -- if there's any place in your code where you wait for things, sleep, etc., then that's your problem.
GUI code in Qt and many other frameworks must be written in run-to-completion fashion. Every slot and event handler must execute as quickly as it can, and then return. When you add a breakpoint in a slot, and look at the stack trace when the code stops, you'll see that QEventLoop::exec() is somewhere there. Ultimately, all GUI code is called from the event loop.
Try reducing your code piecewise until the problem vanishes. That's how you'll know where the blocking part is. Qt provides, unfortunately, many methods named waitxxx(), and they tend to be used without understanding that they block the event loop. A blocked event loop means that the application does not respond to user interaction, and eventually the OS will detect it and issue a spinning beachball (OS X), a spinning circle (Vista/Win7) or perhaps a message about a stuck application. A spinning beachball/circle means that the application's main event loop is blocked.
I'm a long-time user of Opera as a browser for general usage and due to various annoyances with Firefox I decided to give Dragonfly a look. The first thing that has jumped out at me is when debugging JavaScript I can't seem to just step through my script line by line.
I'm using ASP.NET and my script is just a button click event. When I place my breakpoint on the first line of the function and click the button the breakpoint is hit as expected. It's here that I am confused. Dragonfly's window has four buttons on the top left - Continue, Step Into, Step Over and Step Out. If I click Step Over or hit F10 I am expecting that the debugger will step through the JavaScript just like Firebug but instead it seems to immediately skip over the rest of the function altogether. The same thing happens if I click Continue or hit F8. If I click Step Into or hit F11 I start descending into the jQuery JavaScript which is obiously not what I want!
Am I just missing something fundamental here? I'm using Opera 11.52 if it helps.
Just to add more information on the environment I'm working in, Here is a screenshot of my button click event with a breakpoint set on line 14. Execution pauses as expected when I click the button in the browser.
Now, I would expect that some keypress exists to simply bring me to line #15. In Firebug and the IE Dev Tools that keypress is F10. In Dragonfly though F10 seems to just skip the rest of the JavaScript code. The same applies to Shift+F11. F11 by itself brings me to this part of jquery.js which, as mentioned before, is not where I want to be.
this is a bug in Opera which sometimes causes problems when stepping over or out of functions with the Dragonfly debugger.
The only workaround is to set a breakpoint below the function you want to step over, use F10, clear the breakpoint and continue normally. For example, in the first screenshot above you'd set a new breakpoint on line 15, press F8, and clear the breakpoint on line 15 when stopped there. I know this is really annoying :-(
I've done a bit more work on trying to reproduce this bug so that it can get fixed. In Opera's (closed) bug tracker this is now tracked as issue CORE-42532, it seems we're making some progress there so hopefully this annoyance will be gone some day. Meanwhile good luck with your debugging!
Have you seen the documentation for the javascript debugger.
Is there a way to force a JavaFX app to repaint itself before proceeding? Similar to a Swing Panel's paint(Graphic g) method (I might be getting the keywords wrong there).
Consider the following example: you write a TicTacToe app along with the AI required for a computer player. You would like the ability to show two computer players duke it out. Maybe you put in a two second pause between computer turns to give it a life-like affect. When you hit your "Go" button, there's a large pause of unresponsiveness (the time it takes for the 9 turns to go by with faked pauses for the computer to 'decide') and then suddenly the app's visual is updated in with the completed game's state.
It seems like JavaFX repaints once processing in the app's thread is finished? I'm not completely sure here.
Thanks!
You are right. JavaFX is event-driven and single-threaded. This means that repaint and event response can not be done simultaneously. Long-running task should be executed on separate thread so they do not block the rendering of the UI, When the task is finished it can sync back to the FX thread by calling FX.deferAction() which will simply execute the code on the main thread.
This won't be the most helpful answer as I have toyed around with JavaFX for all of half a day, but wouldn't you use Timelines, Keyframes, and binding to accomplish your repaints instead of calling them explicitly like you have described?
See this tutorial for an example.
JavaFX's model is to separate you from the painting of the "stuff" on the screen. This is very powerful but is a change from how you might be familiar with.
whaley is correct that the appropriate way of doing this in JavaFX is to make a timeline where the move is done every X seconds and will be drawn at that keyframe.
If you have a question about how to do this, try it and make a new question with some code.