On Fri, Oct 7, 2016 at 9:14 PM, Thibault Raffaillac <thibault.raffaillac@inria.fr> wrote:
Thanks for these mails, that's actually very helpful! I am working on a shorter syntax for animations at the moment (than GLMAnimation, Viva, Bloc-Animation), and could not find a proper equivalent to requestAnimationFrame (i.e. that would be independent of any UI yet in sync with display, and as simple as possible). My solution was to repeatedly register to deferredUIMessages, implementing an intermediate block to add a timestamp like requestAnimationFrame (works wonders http://smalltalkhub.com/#!/~ThibaultRaffaillac/Animation)
Cheers, Thibault
ps: I'll ask Guille asap for the state of ReactiveExtensions (lacks comments)
Also, check
MorphicUIManager>>#spawnNewProcess
UIProcess := [ [World doOneCycle. Processor yield. false] whileFalse: []. ] newProcess priority: Processor userSchedulingPriority. UIProcess name: 'Morphic UI Process'. UIProcess resume
digging into doOneCycle, you'll find:
#doOneCycleFor: aWorld "Do one cycle of the interaction loop. This method is called *repeatedly *when the world is running. This is a moderately private method; a better alternative is usually either to wait for events or to check the state of things from #step methods."
self interCyclePause: MinCycleLapse. self doOneCycleNowFor: aWorld.
The interCyclePause is what make the UI timing alignment proper (notice serverMode) [and some Squeak remnant mention]:
interCyclePause: milliSecs "delay enough that the previous cycle plus the amount of delay will equal milliSecs. If the cycle is already expensive, then no delay occurs. However, if the system is idly waiting for interaction from the user, the method will delay for a proportionally long time and cause the overall CPU usage of *Squeak* to be low. If self serverMode returns true then, always do a complete delay of 50ms, independant of my argument. This prevents the freezing problem described in Mantis #6581"
| wait wait2 | "*a very long assignment*" wait := self serverMode ifTrue: [ 50 ] ifFalse: [ wait2 := (lastCycleTime notNil and: [CanSurrenderToOS ~~ false]) ifFalse: [ 0 ] ifTrue: [ lastCycleTime + milliSecs - Time millisecondClockValue ].
self flag: 'Issue 14754 - wait2>millisecs is only True for clock rollover. Remove it once DelayScheduler based on microsecondClock - Ben Coman 19.01.2015'. "*<---- maybe we want this #flag: not to be called all
Yes, good idea. I'll see to it. cheers -ben