Skip to content

Commit 8fe2fc9

Browse files
committed
ensure animation curve is a function.
1 parent f618139 commit 8fe2fc9

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

taptapir.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,12 @@ function set_fullscreen(value) {
264264

265265
curves = {
266266
'linear' : (a, b, t) => {
267-
return lerp(a, b, t)},
267+
return lerp(a, b, t)
268+
},
268269

269270
'out_expo' : (a, b, t) => {
270-
return lerp(a, b, t*t)}
271+
return lerp(a, b, t*t)
272+
}
271273
}
272274

273275
ASSETS_FOLDER = ''
@@ -729,8 +731,13 @@ class Entity {
729731
if (!entity.enabled) {
730732
return false}
731733
var t = i / duration / 60
732-
// entity[variable_name] = lerp(start_value, target_value, t)
733-
entity[variable_name] = curve(start_value, target_value, t)
734+
if (typeof curve === 'function') {
735+
entity[variable_name] = curve(start_value, target_value, t)
736+
}
737+
else {
738+
// fallback to linear
739+
// entity[variable_name] = lerp(start_value, target_value, t)
740+
}
734741
},
735742
1000*i/60
736743
)

0 commit comments

Comments
 (0)