Skip to main content

Duration

The duration option sets the duration of the panel snap animation in milliseconds.

import Flicking from "@egjs/flicking";
import "@egjs/flicking/dist/flicking.css";
import "./styles.css";

// duration: 100 (fast)
new Flicking("#flick-fast", {
  duration: 100,
  align: "center"
});

// duration: 500 (default)
new Flicking("#flick-default", {
  duration: 500,
  align: "center"
});

// duration: 1500 (slow)
new Flicking("#flick-slow", {
  duration: 1500,
  align: "center"
});

Summary

Key Options

OptionTypeDefaultDescription
durationnumber500Animation duration (ms)

Comparison by Value

ValueBehaviorSuitable For
100 or lessNear-instant snapUI requiring fast response, games
300-500Natural speedGeneral carousels, image galleries
1000 or moreSlow transitionPresentations, emphasis effects

Details

How Duration Works

After finishing a drag and releasing, the panel snaps to the target position. duration is the time it takes for this snap animation to complete.

// Various duration values
duration: 100 // Fast snap (0.1s)
duration: 500 // Default (0.5s)
duration: 1500 // Slow snap (1.5s)
duration: 0 // Move instantly without animation
  • Relationship with easing: duration determines the animation time, while easing determines the animation curve. Combine both to create various transition effects.
  • Relationship with moveType: With moveType: "freeScroll", inertial scrolling is applied and may behave differently from duration.

Use Cases

When to use?
  • Short duration (100-300ms): UI where fast response matters, tab switching, game interfaces
  • Default duration (400-600ms): General carousels, image galleries
  • Long duration (800ms+): Presentations, onboarding, emphasizing transition effects

Notes

Using duration: 0

Setting duration: 0 causes instant movement without animation. Be cautious as the lack of visual feedback may confuse users.

Too long duration

A duration over 1 second may make users feel like they are waiting. Unless intentional, around 500ms is recommended.