Animation

See also Physics

Resources

The illusion of life

![The illusion of life_hd.mp4](The illusion of life_hd.mp4) ![10 principles of motion design.mp4](10 principles of motion design.mp4)

Precision

Eular method is frame based More precise is time based

The Eular method simplifies equation:

The semi-implicit euler (better):

frame skip = based on time non frame skip = based on number frames. It's not precise especially if the frame rate is irregular or not at the original speed

Recusive functions are frame based

Eular method:

See also:

Time based (use integration and calculus):

Eular method

Inching

Aka Ease out animation

position += (destination - position) * friction

Elastic

Simple harmonic motion — Wikipedia

Flexible Partial Shifts

Waveform

Heartthrob

Easing

See also Catmull–Rom spline and Gradient

Time progression

Animation duration

Physics based

Animation based on physics

Use friction, attraction force (gravity, magnetism), push force Mass, velocity (speed + direction), momentum

See Physics

  • Lib for lot of domains (math, graphics) https://github.com/hapticdata/toxiclibsjs from http://toxiclibs.org/about/

  • https://en.wikipedia.org/wiki/Physics_engine

  • A posteriori (discrete) versus a priori (continuous) computation: https://en.wikipedia.org/wiki/Collision_detection#A_posteriori_.28discrete.29_versus_a_priori_.28continuous.29

  • https://openclassrooms.com/courses/theorie-des-collisions

  • Parametric easing (easing function with parameters like frequency, friction) http://dynamicsjs.com

  • game libs http://phaser.io https://libgdx.badlogicgames.com/index.html

  • native JS canvas only lib https://github.com/phoboslab/Ejecta

https://en.wikipedia.org/wiki/Force https://en.wikipedia.org/wiki/Classical_mechanics

Cat walking

Cats have a very precise method of walking, called “direct registering”, wherein their hind paws fall almost exactly into the place their fore paws did a moment before—this method of walking minimizes noise and visible tracks while ensuring more stable footing as the place has already been felt out by the fore paws

Draggable with inertia

Scrollable, deceleration, rubber band, paging (aka Soft close drawer)

Linear Motion Equations:

vf = vi + at d = ½(vf + vi)t d = vi∙t + ½at vf² = vi² + 2ad

where:

  • d is displacement (∆x)

  • t is time of travel (∆t)

  • a is rate of constant acceleration

  • vi is initial velocity

  • vf is final velocity

https://s2.studylib.net/store/data/005704450.pdf?key=7f28457ce04d3cb302b11a2f52dba5b3&r=1&fn=5704450.pdf&t=1536095317883&p=600

Rubber-banding: x = (1.0 - (1.0 / ((x * c / d) + 1.0))) * d or x = x * 0.5

f(x, d, c) = (x * d * c) / (d + c * x)

where:

  • x is distance from the edge

  • c is constant (UIScrollView uses 0.55)

  • d is dimension, either width or height

UIScrollView to find out the formulae its using for paging, inertia, and bouncing: rubber banding: offset = (0.55 * offset * height) / (height + 0.55 * offset); inertia: exponential decay with .decelerationRate

Like scroll with touch or mouse wheel. See also http://dev.w3.org/csswg/css-snappoints/, -ms-scroll-limit (offlimit bounce) and https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/IpBdJEppjzE/V1Biy1D4v-kJ

Scroll time based on distance:

Friction:

vector velocity = speed + direction

google maps Speed decrease like POWER2

f(x) = 99.9%^x

drop (a=0→1)

v = d / t where v = speed or velocity d = distance t = time or duration

stopping distance: start velocity to 0 d = k * v * v, where d = distance k = friction coef v = start speed or velocity

stopping duration?ranl(fr) t = d / v t = time or duration v = average speed or velocity (= start speed / 2) d = distance

In source of the map engine Leaflet https://github.com/Leaflet/Leaflet/blob/63fd4edc76893ab2a2f83d54e703e0a4da73de7b/src/map/handler/Map.Drag.js

Particles

Character control

Last updated

Was this helpful?