easing-functions

Reimplement UIView block based animation methods with custom easing curve

流过昼夜 提交于 2020-01-01 03:46:06
问题 The lack of custom easing curves in UIView's block based animation methods leads to Core Animation if more advanced curves are needed. A way of doing this with a Category on CAKeyframeAnimation is discussed in How to create custom easing function with Core Animation?. To keep my code clean and maintainable I would like to go a step further and re-implement UIView 's block based methods and include a block describing the easing curve function. resulting category on UIView would look something

Calculate initial velocity to move a set distance with inertia

故事扮演 提交于 2019-12-30 03:26:08
问题 I want to move something a set distance. However in my system there is inertia/drag/negative accelaration. I'm using a simple calculation like this for it: v = oldV + ((targetV - oldV) * inertia) Applying that over a number of frames makes the movement 'ramp up' or decay, eg: v = 10 + ((0 - 10) * 0.25) = 7.5 // velocity changes from 10 to 7.5 this frame So I know the distance I want to travel and the acceleration, but not the initial velocity that will get me there. Maybe a better explanation

Help with custom jquery easing function

半腔热情 提交于 2019-12-23 21:24:08
问题 I need a rather atypical jquery easing function. It's basically the opposite of your traditional easeInOut easing because I want the process to go from a fast intro to a slower middle part to a fast outro (you might call it speedInOut). Unfortunately my math is a little rusty and I need someone to point me in the right direction in terms of how to get started. A hyperbolical sinus curve (sinh) goes somewhat in the right direction of what I'm looking for , but I need it limited between 0 and 1

Jquery ScrollTo Easing

天大地大妈咪最大 提交于 2019-12-12 09:38:13
问题 Can´t apply an easing method to Jquery ScrollTo: $("#scroller").scrollTo(target,1000,{axis:'x',easing:'linear'}); This doesn´t ease anything... Im starting to use jquery now (been using prototype for long) so this is surely my mistake. Do I need an easing plugin to achieve this? What are the easing option for this plugin (if any)? The documentation is not clear about this. Thanks. 回答1: From jQuery: The only easing implementations in the jQuery library are the default, called swing, and one

Help formulating a cubic easing equation

帅比萌擦擦* 提交于 2019-12-10 09:45:32
问题 I have the following piece of code int steps = 10; for (int i = 0; i <= steps; i++) { float t = i / float(steps); console.log( "t " + t ); } That out puts numbers in a linear fashion like this { 0, 0.1, 0.2, ..., 0.9, 1.0 } I would like apply the cubic (in or out) easing equation so the output numbers increase or decrease gradually UPDATE Not sure if my implementation if correct but I am getting curve as expected float b = 0; float c = 1; float d = 1; for (int i = 0; i <= steps; i++) { float

Help formulating a cubic easing equation

心已入冬 提交于 2019-12-05 18:47:41
I have the following piece of code int steps = 10; for (int i = 0; i <= steps; i++) { float t = i / float(steps); console.log( "t " + t ); } That out puts numbers in a linear fashion like this { 0, 0.1, 0.2, ..., 0.9, 1.0 } I would like apply the cubic (in or out) easing equation so the output numbers increase or decrease gradually UPDATE Not sure if my implementation if correct but I am getting curve as expected float b = 0; float c = 1; float d = 1; for (int i = 0; i <= steps; i++) { float t = i / float(steps); t /= d; float e = c * t * t * t + b; console.log( "e " + e ); //console.log( "t "

Jquery ScrollTo Easing

时光毁灭记忆、已成空白 提交于 2019-12-05 05:17:10
Can´t apply an easing method to Jquery ScrollTo: $("#scroller").scrollTo(target,1000,{axis:'x',easing:'linear'}); This doesn´t ease anything... Im starting to use jquery now (been using prototype for long) so this is surely my mistake. Do I need an easing plugin to achieve this? What are the easing option for this plugin (if any)? The documentation is not clear about this. Thanks. From jQuery: The only easing implementations in the jQuery library are the default, called swing, and one that progresses at a constant pace, called linear . So easing: 'linear' is not supposed to show anything. Try

Reimplement UIView block based animation methods with custom easing curve

我怕爱的太早我们不能终老 提交于 2019-12-03 09:15:10
The lack of custom easing curves in UIView's block based animation methods leads to Core Animation if more advanced curves are needed. A way of doing this with a Category on CAKeyframeAnimation is discussed in How to create custom easing function with Core Animation? . To keep my code clean and maintainable I would like to go a step further and re-implement UIView 's block based methods and include a block describing the easing curve function. resulting category on UIView would look something like this: + (void)animateWithDuration:(NSTimeInterval)duration easingCurveFunction:(double(^)(double)

How to apply easing animation function on view in Android

拟墨画扇 提交于 2019-11-27 13:17:04
问题 I want to apply a translate animation on an Android view (button) using a custom interpolator where the easing function is: public static float easeOut(float t,float b , float c, float d) { if ((t/=d) < (1/2.75f)) { return c*(7.5625f*t*t) + b; } else if (t < (2/2.75f)) { return c*(7.5625f*(t-=(1.5f/2.75f))*t + .75f) + b; } else if (t < (2.5/2.75)) { return c*(7.5625f*(t-=(2.25f/2.75f))*t + .9375f) + b; } else { return c*(7.5625f*(t-=(2.625f/2.75f))*t + .984375f) + b; } } I have an example

What is an easing function?

☆樱花仙子☆ 提交于 2019-11-27 06:10:34
What is meant by easing function in the context of animation. It seems that dojo, jquery, silverlight, flex and other UI systems have the notion of easing function. I could not locate a good explanation of easing functions? Can anyone explain the concept of easing functions, or point a good explanation of them, I am interested in the concept not in the specific details of a framework? Is easing strictly used for location or is it general and can be applied to any property of an object? J. Holmes An easing function is usually a function that describes the value of a property given a percentage