Skip to content

Commit 47dff22

Browse files
committed
UUpdate Path getNormalized
1 parent 4c34c7e commit 47dff22

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

modules/ILL/ILL.moon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module_version = "1.5.8"
1+
module_version = "1.5.9"
22

33
haveDepCtrl, DependencyControl = pcall require, "l0.DependencyControl"
44

modules/ILL/ILL/Ass/Shape/Path.moon

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -367,17 +367,33 @@ class Path
367367
length += seg\getLength!
368368
return length
369369

370+
-- Gets the normalized tangent on the Path given a time
370371
-- Gets the normalized tangent on the Path given a time
371372
getNormalized: (t = 0.5) =>
372-
sumLength, length, tan, p, u = 0, t * @getLength!, nil, nil, nil
373-
@callBackPath (id, seg) ->
374-
segmentLen = seg\getLength!
373+
sumLength, length, newPath, tan, p, u = 0, t * @getLength!, Path!, nil, nil, nil
374+
@callBackPath (id, seg, k) ->
375+
path, segmentLen = {}, seg\getLength!
376+
if newPath.path[k] == nil
377+
newPath.path[k] = {seg.a}
375378
if sumLength + segmentLen >= length
376379
u = (length - sumLength) / segmentLen
377380
tan, p, u = seg\getNormalized u
378-
return "break"
381+
spt = seg\split(u)[1]
382+
if id == 'l'
383+
insert newPath.path[k], spt.b
384+
else if id == 'b'
385+
insert newPath.path[k], spt.b
386+
insert newPath.path[k], spt.c
387+
insert newPath.path[k], spt.b
388+
return "break", p, u, newPath
389+
if id == 'l'
390+
insert newPath.path[k], seg.b
391+
else
392+
insert newPath.path[k], seg.b
393+
insert newPath.path[k], seg.c
394+
insert newPath.path[k], seg.d
379395
sumLength += segmentLen
380-
return tan, p, u
396+
return tan, p, u, newPath
381397

382398
-- Distort the Path into another Path
383399
-- http://www.planetclegg.com/projects/WarpingTextToSplines.html

0 commit comments

Comments
 (0)