File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -235,8 +235,8 @@ export default function AnimatedLines({
235
235
236
236
// Only dots (length 1) can change orientation, others keep their orientation
237
237
if ( newLength === 1 ) {
238
- // Dots can have random orientation with 75 % chance of being horizontal
239
- newIsHorizontal = Math . random ( ) < 0.75
238
+ // Dots can have random orientation with 50 % chance of being horizontal
239
+ newIsHorizontal = Math . random ( ) < 0.5
240
240
} else {
241
241
// Non-dots must keep their original orientation
242
242
newIsHorizontal = line . isHorizontal
@@ -266,10 +266,19 @@ export default function AnimatedLines({
266
266
}
267
267
if ( newX < 0 ) newX = 0
268
268
} else {
269
- if ( newY + newLength > rowCount ) {
270
- newY = Math . max ( 0 , rowCount - newLength )
269
+ // If vertical line is currently at max height, shrink it to size 1
270
+ if (
271
+ line . length >= rowCount ||
272
+ ( line . y + line . length >= rowCount && line . length > 1 )
273
+ ) {
274
+ newLength = 1
275
+ newY = Math . floor ( Math . random ( ) * rowCount )
276
+ } else {
277
+ if ( newY + newLength > rowCount ) {
278
+ newY = Math . max ( 0 , rowCount - newLength )
279
+ }
280
+ if ( newY < 0 ) newY = 0
271
281
}
272
- if ( newY < 0 ) newY = 0
273
282
}
274
283
275
284
attempts ++
You can’t perform that action at this time.
0 commit comments