11/**
22 * Anime.js - ESM bundle
3- * @version v4.2.1
3+ * @version v4.2.2
44 * @license MIT
55 * @copyright 2025 - Julian Garnier
66 */
@@ -796,7 +796,7 @@ const globals = {
796796 tickThreshold : 200 ,
797797} ;
798798
799- const globalVersions = { version : '4.2.1 ' , engine : null } ;
799+ const globalVersions = { version : '4.2.2 ' , engine : null } ;
800800
801801if ( isBrowser ) {
802802 if ( ! win . AnimeJS ) win . AnimeJS = [ ] ;
@@ -7655,12 +7655,15 @@ const getPath = path => {
76557655 * @param {SVGGeometryElement } $path
76567656 * @param {Number } totalLength
76577657 * @param {Number } progress
7658- * @param {Number }lookup
7658+ * @param {Number } lookup
7659+ * @param {Boolean } shouldClamp
76597660 * @return {DOMPoint }
76607661 */
7661- const getPathPoint = ( $path , totalLength , progress , lookup = 0 ) => {
7662+ const getPathPoint = ( $path , totalLength , progress , lookup , shouldClamp ) => {
76627663 const point = progress + lookup ;
7663- const pointOnPath = ( point % totalLength + totalLength ) % totalLength ;
7664+ const pointOnPath = shouldClamp
7665+ ? Math . max ( 0 , Math . min ( point , totalLength ) ) // Clamp between 0 and totalLength
7666+ : ( point % totalLength + totalLength ) % totalLength ; // Wrap around
76647667 return $path . getPointAtLength ( pointOnPath ) ;
76657668} ;
76667669
@@ -7675,6 +7678,7 @@ const getPathProgess = ($path, pathProperty, offset = 0) => {
76757678 const totalLength = + ( $path . getTotalLength ( ) ) ;
76767679 const inSvg = $el [ isSvgSymbol ] ;
76777680 const ctm = $path . getCTM ( ) ;
7681+ const shouldClamp = offset === 0 ;
76787682 /** @type {TweenObjectValue } */
76797683 return {
76807684 from : 0 ,
@@ -7684,11 +7688,11 @@ const getPathProgess = ($path, pathProperty, offset = 0) => {
76847688 const offsetLength = offset * totalLength ;
76857689 const newProgress = progress + offsetLength ;
76867690 if ( pathProperty === 'a' ) {
7687- const p0 = getPathPoint ( $path , totalLength , newProgress , - 1 ) ;
7688- const p1 = getPathPoint ( $path , totalLength , newProgress , 1 ) ;
7691+ const p0 = getPathPoint ( $path , totalLength , newProgress , - 1 , shouldClamp ) ;
7692+ const p1 = getPathPoint ( $path , totalLength , newProgress , 1 , shouldClamp ) ;
76897693 return atan2 ( p1 . y - p0 . y , p1 . x - p0 . x ) * 180 / PI ;
76907694 } else {
7691- const p = getPathPoint ( $path , totalLength , newProgress , 0 ) ;
7695+ const p = getPathPoint ( $path , totalLength , newProgress , 0 , shouldClamp ) ;
76927696 return pathProperty === 'x' ?
76937697 inSvg || ! ctm ? p . x : p . x * ctm . a + p . y * ctm . c + ctm . e :
76947698 inSvg || ! ctm ? p . y : p . x * ctm . b + p . y * ctm . d + ctm . f
0 commit comments