top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is tweening in css?

+1 vote
1,412 views
What is tweening in css?
posted Mar 28, 2017 by Snehal Raikar

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

The pose-to-pose option is to create a few keyframes throughout the sequence, and then fill in the gaps later. Filling in these gaps is known as “in-betweening,” or “tweening,” a familiar term for those used to animating in Flash. With CSS animation, we typically use the latter, pose to pose.

Tweens a DOM element using CSS matrix3d() and 4x4 matrix interpolation (decomposition/recomposition). This allows for a smooth range of 3D rotations (using quaternions and spherical interpolation) without gimbal lock.

Typically used with tween-ticker or tweenr. Example:

var tweenr = require('tweenr')()
var Transform = require('tween-css-transform')

//you can specify transform strings 
var tween1 = Transform(element, {
    duration: 1,
    delay: 0.5, 
    ease: 'expoOut',
    start: 'translateX(10px) rotateX(90deg)'
    end: 'matrix(1,0,0,1,0,0)'
})
tweenr.to(tween1)

//or you can "compose" a matrix with 3D components 
var tween2 = Transform(element, {
    duration: 1,
    delay: 2,
    end: { 
        rotation: [0, Math.PI/2, 0],
        translation: [25, 15, 50],
        scale: [1, 1.25, 1.5]
    }
})
tweenr.to(tween2)

//a "from-to" tween, tweens from given transform to its initial state 
var tween3 = Transform(foobar, {
    duration: 1,
    start: 'translateX(25px)'
})
tweenr.to(tween3)
answer Apr 3, 2017 by Manikandan J
...