Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add segment duration getter #194

Closed
2 tasks
rismirnov opened this issue May 16, 2024 · 2 comments
Closed
2 tasks

Add segment duration getter #194

rismirnov opened this issue May 16, 2024 · 2 comments
Labels
enhancement New feature or request web

Comments

@rismirnov
Copy link

rismirnov commented May 16, 2024

Overview

I suggest adding a getter to get the duration of a given segment [startFrame, endFrame].

const player = new DotLottie({ segment: [0, 100], /* other params */ })
const frameRate = player.totalFrames / player.duration;
const segmentDuration = 1000 * (player.segment[1] - player.segment[0] + 1) / frameRate;

Type

  • New feature

Motivation

I needed to determine how much time remained before the segment would finish playing after some time

Labels

  • Add the Type: Feature Request label to this issue.
@theashraf theashraf added enhancement New feature or request web labels May 17, 2024
@theashraf
Copy link
Member

Thanks @rismirnov
I think this is a good addition. Just one note from my side: to minimize the impact on the bundle size, we can add this as a utility function that we export from our dotlottie-web package for optional use. Adding it directly to the DotLottie class would unnecessarily increase the bundle size, as this is not a very common use case.

@theashraf
Copy link
Member

@rismirnov has been added in @lottiefiles/dotlottie-web@0.23.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request web
Projects
None yet
Development

No branches or pull requests

2 participants