MCPcopy Create free account
hub / github.com/Moebytes/Frame-Player / update

Function update

components/VideoPlayer.tsx:526–568  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

524 }
525
526 const update = () => {
527 if (!adjustedData) return
528 const totalFrames = adjustedData.length - 1
529 let startFrame = 0
530 let endFrame = totalFrames
531
532 if (reverse) {
533 pos--
534 } else {
535 pos++
536 }
537
538 if (abloop) {
539 const {startTime, endTime} = getABBounds()
540
541 startFrame = Math.floor(startTime / interval)
542 endFrame = Math.floor(endTime / interval)
543
544 if (startFrame < 0) startFrame = 0
545 if (endFrame > totalFrames) endFrame = totalFrames
546 }
547
548 if (abloop) {
549 if (!reverse && pos > endFrame) pos = startFrame
550 if (reverse && pos < startFrame) pos = endFrame
551 } else {
552 if (pos > totalFrames) {
553 pos = 0
554 if (animation && !loop) return setPaused(true)
555 }
556 if (pos < 0) {
557 pos = totalFrames
558 if (animation && !loop) return setPaused(true)
559 }
560 }
561
562 if (adjustedData[pos]) frame = adjustedData[pos].frame
563 currentTime = pos * interval
564
565 if (!dragging) {
566 setProgress(reverse ? duration - currentTime : currentTime)
567 }
568 }
569
570 const draw = () => {
571 if (sharpenOverlay) {

Callers 2

animateFPSFunction · 0.85
animateVideoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected