I am looking for the particular easing function that besides standard parameters considers also:
Accelerate: Percentage of the duration over which acceleration (in part of the animation) should take place.
Decelerate: Percentage of the duration over which deceleration (out part of the animation) should take place.
BounceEndIntensity: Percentage of the duration over which BounceEnd (out part of the animation) should take place.
It is not possible to use BounceEndIntensity and Delereate at the same time. This particular easing function is also used for the animations in PowerPoint, but I couldn't find its name in relation with PowerPoint.
Thanx for any ideas!
Related
I'm animating a camera in my scene and have been playing with Quaternion.slerp() and Vector3.lerpVectors().
With lerpVectors, I have a function that takes in a Vector3 to look at, and a duration to animate across, e.g.
rotateCameraToDestination(new Vector(1,1,1), 3);
With slerp, I have an identical function that takes in a Quaternion to orient to, and also a duration to animate across, e.g.
rotateCameraToDestination(new Quaternion().setFromRotationMatrix(m), 3);
Both durations are 3 seconds (both using delta time to animate during render loop) yet when I test the slerp function, I generally have to increase the duration to something like 30 or 300.
Do the two methods interpolate at different rates?
Any explanation would be appreciated, I need to leave appropriate documentation on any functions I develop, cheers
EDIT
As mentioned in my comment, I think that because I was updating the start position for my lerp function, it starts quickly, then ends slow, the slerp was just consistent rate, as I wasn't changing the start quaternion each frame.
So they just appeared to run at different rates.
Crudely represented like this:
LERP:
l-------l-------l-----l----l----l---l---l--l--l--l-l-llll
SLERP:
l---l---l---l---l---l---l---l---l---l---l---l---l---l---l
Sorry for hassle guys :(
I cannot figure out how to apply multiple animatedupdate 'tour steps' in KML. Please help. All data is linked here to demonstrate the problem. In this example.. first open the link to the rail model - this has the snap shot that takes you (the user) to the project area. Zoom in on the northern most rail curve. Then open the other KMZ - named DOC02 ... DOC02 provides the animation (Tour) ... play the tour (part 2) and ... the hopper goes a short way around the curve, although the tour data has enough steps to almost complete the entire curve - Why are only the first 3 animated updates applied? ... At first I tried to use the guides referred to by countless other stack overflow posts on this topic. But that result was even worse. The 3d model has a location ID of t1 and an orientation ID of t2. When I use these as target ID in the animated updates - Yuck! the animation is totally incorrect, model goes directly to the end of the curve. So. I added ID's at every transform change. This idea provided better animation but the animation only uses the first 2 animated updates. If all this text just gives people a headache, just let me know and I will provide a video ... I probably will make one later today anyway. Thanks for your patience.
overhead rail model in KMZ Google Earth
3d hopper model set go move around curve in KMZ Google Earth
https://developers.google.com/kml/documentation/touring#gxanimatedupdate-and-the-tour-timeline
The above link will take you to the kml documentation page which specifically states that:
"Animated updates run parallel to the timeline - that is, the tour continues directly to the next tour primitive in the playlist, while the animated update is taking place. The gx:duration controls the length of time it takes for the update to occur, but doesn't delay the next tour primitive. To allow an animated update to complete before the next action takes place, insert a gx:Wait, with a duration equal to the duration of the update, between the animated update and the following tour primitive. In addition, an animated update will be truncated if its duration extends beyond that of the last gx:FlyTo or gx:Wait element. You can either change the appropriate gx:duration values, or insert an additional gx:Wait element at the end of the playlist to give the animated update time to complete.
Which essentially is telling you that AnimatedUpdate will not keep the tour going. Only flyTo and Wait will prolong the tour. The reason why your tour ends after the first 2 animations is because that is all the animations it can get through within the tour length.
Basically, to fix your issue, insert a gx:wait with a duration >= your AnimatedUpdate's duration after EACH AnimatedUpdate. This will prolong the tour and allow your animations time to complete before the tour ends. (because the gx:wait prolongs the tour)
(Alternatively, add a long enough Wait at the beginning, much like you did with the end.)
Also see: https://developers.google.com/kml/documentation/touring#tour-timelines
I have started looking into the client side performance of my app using Chrome's Timeline tools. However, whilst I have found many articles on how to use them, information on how to interpret the results is more sparse and often vague.
Currently I am looking at scroll performance and attempting to hit 60FPS.
This screenshot show's the results of my most recent timeline recording.
As can be seen most frames are over 60 FPS and several are over 30 FPS.
If I zoom in on one particular frame - the one with duration 67.076ms I can see a few things:
the duration of the frame is 67ms, but aggregated time is 204ms
201ms of this time is spent painting BUT the two paint events in
this frame are of duration 1.327 ms and 0.106 ms
The total duration for the JS event, update layer tree and paint events is
only 2.4 ms
There is a long green hollow bar (rasterize Paint)
which lasts the duration of the frame and in fact starts before and
continues after it.
I have a few questions on this:
the aggregated time is far longer than the frame time - is it
correct to assume that these are parrallel processes?
the paint time for the frame (204ms) far exceeds the time for the two paint events (1.433ms) - is this because it includes the
rasterize paint events
why does the rasterize paint event span multiple frames?
where would one start optimizing this?
Finally can someone point me to some good resources on understanding this?
This is somewhat unfortunate result of the way the 'classic' waterfall Timeline view coalesces multiple events. If you expand that long "Rasterize Paint" event, you'll see a bunch of individual events, which are going to be somewhat shorter. You may really want to switch to Flame Chart mode for troubleshooting rendering performance, where the rasterize events are shown on appropriate threads.
I'm trying to make the stage.show() slow down. I figured out I might need to set KeyFrame, but am stuck at KeyValue, not understanding T endValue or Interpolator interpolator. Is this the right approach? If so could anyone explain to me what type is T.
Thank you!
You can't slow stage.show() down, if stage is a JavaFX Stage, because this is not an animation.
Controlling Animation Speed
An animation's speed is primarily controlled by its rate. Varying either the rate of playback of the animation or the duration of the animation will probably be all you need to do to get the animation speed you want.
animation.setRate(2) // play the animation at double speed.
animation.setRate(0.5) // play the animation at half speed.
On Interpolation
An interpolator is a mathematical function for calculating intermediate values between points. Here is an article on interpolation.
In JavaFX, the interpolators are used to define easing functions for changing values between keyframes of an animation. Likely, for what you are doing, either a straight linear interpolator or an ease in + ease out interpolator will be fine (those are the two most commonly used interpolators). Most of the time, the default interpolator used by JavaFX suffices and you don't have to change it.
The apparent speed of an animation might also be effected by the interpolated easing function applied to the animation's key values or by the magnitude of a keyvalue change (e.g. number of pixels translated, number of times to scale) divided by the keyframe's duration.
Further reference
If you don't understand what this means, then read the JavaFX animation documentation which will define the terms referenced and provide examples on how to use them.
Additional items in your question
What you want to do ("stage.show() slow down") is ambiguous to me in the context of animations, so I couldn't advise an approach for that - as TheJeed correctly states stage.show() is not an animation, so it makes no sense to try to apply animation to a stage.show() call.
T in the context of a KeyValue is a generic type, which seems to answer the question in your question but not the question in your title.
I agree the question was poorly asked. I didn't have the right approach. Just simply changing thread.sleep() will do the work.
But thank you guys anyway!
Say like it took a whole second for a character to jump in a game, how would a game developer go about keeping that jump time to 1 second if the FPS is either 10fps, 30fps, 100fps etc? - If you get me, how would you stop a game's fps affecting the gameplay speed basically.
I presume there's a certain method of doing this, so I was wondering what exactly it is?
Thankssss,
Alex!
Normally by using a timer to record how much time has passed since the last frame was rendered. There are many articles and samples on the subject available via Google:
Achieving Frame Rate Independent Game Movement
Constant game speed independent of variable FPS in OpenGL with GLUT?
Fixed time step vs Variable time step
Fix Your Timestep!
Of course if your FPS is allowed to be anything then you will end up with unrealistic simulations. For this reason there is the concept of a "fixed time step".
The "Fix Your Timestep!" (and the previous articles linked on that page) in particular is a good read on this subject.
Short answer of a large subject
I guess your game should place "animation" not determine by its frame sequences number but by the time delay from a reference...
1)example : 1 second jump with only 3 drawing ... should be considere draw#1 a t0 draw#2 if between t+0.25 and t+0.75 and draw#3 if between t+0.75 and t+1
2) example : if your move/animation is determined by a formula like positionX(int RelativeFrameNumber) your should consider change your fonction by using time like positionX(long relativeTimeInMillisecond)
or with small change in your gameloop
3) place a "wait" code in your loop that is calibrate depending a continuously/fixed computed framerate performance
Hope that help
Many physics engines pass around a delta time in an update() method of some kind.
void update(float dt)
This delta value represents the current frame step proportional to a fixed frame rate (say, 60fps). For example, if dt is 1.0, then we're at 60fps, if dt is 2.0, then we're 30fps and if dt is 0.5 then we are at 120fps.. etc..
To move (in your case, jump) a character at the same speed for any frame rate, multiply dt by the object's velocity vector to keep the character jumping at the same speed.
void update(float dt)
{
myChar.Vel += myChar.Direction.Normalized() * myChar.Speed * dt;
//myChar.Speed is in meters per second
}
Note: Different calculation is required for quadratic physics.