Skip to content

Commit 28755bc

Browse files
committed
Better handling at beginnings as well.
1 parent 5de5893 commit 28755bc

1 file changed

Lines changed: 45 additions & 40 deletions

File tree

@Basic_S.tra2

Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,18 @@ SOFTWARE.
2323
https://mit-license.org/
2424
]]
2525
@全体で時間制御
26-
--information:全体で時間制御@Basic_S v1.72-beta3 (for beta26) by σ軸
26+
--information:全体で時間制御@Basic_S v1.72-beta4 (for beta26) by σ軸
2727
--label:Basic_S
2828
--timecontrol
2929
local gp = obj.getpoint;
3030
local n, i, t = gp("num"), math.modf(gp("timecontrol", "index"));
31-
if i >= n - 1 then i, t = n - 2, 1 end
31+
if i >= n - 1 then i, t = n - 2, 1;
32+
elseif i < 0 then i, t = 0, 0 end
3233
local v0, v1 = gp(i), gp(i + 1);
3334
return v0 + (v1 - v0) * t;
3435

3536
@区間ごとに時間制御
36-
--information:区間ごとに時間制御@Basic_S v1.72-beta3 (for beta26) by σ軸
37+
--information:区間ごとに時間制御@Basic_S v1.72-beta4 (for beta26) by σ軸
3738
--label:Basic_S
3839
--timecontrol
3940
local gp = obj.getpoint;
@@ -44,7 +45,7 @@ local v0, v1 = gp(i), gp(i + 1);
4445
return v0 + (v1 - v0) * t;
4546

4647
@正弦波
47-
--information:正弦波@Basic_S v1.72-beta3 (for beta26) by σ軸
48+
--information:正弦波@Basic_S v1.72-beta4 (for beta26) by σ軸
4849
--label:Basic_S\基本緩急
4950
--speed:0,1
5051
local gp, math = obj.getpoint, math;
@@ -61,7 +62,7 @@ local rho = 1 - math.cos(math.pi / 2 * t);
6162
return v0 + (v1 - v0) * rho;
6263

6364
@2次式
64-
--information:2次式@Basic_S v1.72-beta3 (for beta26) by σ軸
65+
--information:2次式@Basic_S v1.72-beta4 (for beta26) by σ軸
6566
--label:Basic_S\基本緩急
6667
--speed:0,1
6768
local gp, math = obj.getpoint, math;
@@ -78,7 +79,7 @@ local rho = t ^ 2;
7879
return v0 + (v1 - v0) * rho;
7980

8081
@3次式
81-
--information:3次式@Basic_S v1.72-beta3 (for beta26) by σ軸
82+
--information:3次式@Basic_S v1.72-beta4 (for beta26) by σ軸
8283
--label:Basic_S\基本緩急
8384
--speed:0,1
8485
local gp, math = obj.getpoint, math;
@@ -95,7 +96,7 @@ local rho = t ^ 3;
9596
return v0 + (v1 - v0) * rho;
9697

9798
@4次式
98-
--information:4次式@Basic_S v1.72-beta3 (for beta26) by σ軸
99+
--information:4次式@Basic_S v1.72-beta4 (for beta26) by σ軸
99100
--label:Basic_S\基本緩急
100101
--speed:0,1
101102
local gp, math = obj.getpoint, math;
@@ -112,7 +113,7 @@ local rho = t ^ 4;
112113
return v0 + (v1 - v0) * rho;
113114

114115
@N次式
115-
--information:N次式@Basic_S v1.72-beta3 (for beta26) by σ軸
116+
--information:N次式@Basic_S v1.72-beta4 (for beta26) by σ軸
116117
--label:Basic_S\基本緩急
117118
--speed:0,1
118119
--param:次数N,5
@@ -131,7 +132,7 @@ local rho = (N > 0 or t > 0) and t ^ N or 0;
131132
return v0 + (v1 - v0) * rho;
132133

133134
@指数関数
134-
--information:指数関数@Basic_S v1.72-beta3 (for beta26) by σ軸
135+
--information:指数関数@Basic_S v1.72-beta4 (for beta26) by σ軸
135136
--label:Basic_S\基本緩急
136137
--speed:0,1
137138
--param:減衰率,2
@@ -150,7 +151,7 @@ local rho = a > 0 and (math.exp(a * t) - 1) / (math.exp(a) - 1) or t;
150151
return v0 + (v1 - v0) * rho;
151152

152153
@円形
153-
--information:円形@Basic_S v1.72-beta3 (for beta26) by σ軸
154+
--information:円形@Basic_S v1.72-beta4 (for beta26) by σ軸
154155
--label:Basic_S\基本緩急
155156
--speed:0,1
156157
local gp, math = obj.getpoint, math;
@@ -167,7 +168,7 @@ local rho = 1 - (1 - t ^ 2) ^ 0.5;
167168
return v0 + (v1 - v0) * rho;
168169

169170
@等速移動(秒)
170-
--information:等速移動(秒)@Basic_S v1.72-beta3 (for beta26) by σ軸
171+
--information:等速移動(秒)@Basic_S v1.72-beta4 (for beta26) by σ軸
171172
--label:Basic_S
172173
--twopoint
173174
--param:単位時間(秒),1
@@ -178,7 +179,7 @@ if T == 0 then T = 1 end
178179
return v0 + (v1 - v0) * t / T;
179180

180181
@等速移動(フレーム)
181-
--information:等速移動(フレーム)@Basic_S v1.72-beta3 (for beta26) by σ軸
182+
--information:等速移動(フレーム)@Basic_S v1.72-beta4 (for beta26) by σ軸
182183
--label:Basic_S
183184
--twopoint
184185
--param:単位時間(フレーム),60
@@ -190,7 +191,7 @@ if F == 0 then F = 1 end
190191
return v0 + (v1 - v0) * f / F;
191192

192193
@コマ落ち反復(秒)
193-
--information:コマ落ち反復(秒)@Basic_S v1.72-beta3 (for beta26) by σ軸
194+
--information:コマ落ち反復(秒)@Basic_S v1.72-beta4 (for beta26) by σ軸
194195
--label:Basic_S\コマ落ち
195196
--twopoint
196197
--param:周期(秒),0.5
@@ -201,7 +202,7 @@ if T == 0 then T = 1 end
201202
return gp(((t / T) % 1) < 0.5 and 0 or 1);
202203

203204
@コマ落ち反復(フレーム)
204-
--information:コマ落ち反復(フレーム)@Basic_S v1.72-beta3 (for beta26) by σ軸
205+
--information:コマ落ち反復(フレーム)@Basic_S v1.72-beta4 (for beta26) by σ軸
205206
--label:Basic_S\コマ落ち
206207
--twopoint
207208
--param:周期(フレーム),30
@@ -213,7 +214,7 @@ if F == 0 then F = 1 end
213214
return gp(((f / F) % 1) < 0.5 and 0 or 1);
214215

215216
@コマ落ち反復(Hz)
216-
--information:コマ落ち反復(Hz)@Basic_S v1.72-beta3 (for beta26) by σ軸
217+
--information:コマ落ち反復(Hz)@Basic_S v1.72-beta4 (for beta26) by σ軸
217218
--label:Basic_S\コマ落ち
218219
--twopoint
219220
--param:周期(Hz),2
@@ -223,7 +224,7 @@ if 1 / N < 0 then t, N = t - gp("time", 1) - 1 / gp("framerate"), -N end
223224
return gp(((t * N) % 1) < 0.5 and 0 or 1);
224225

225226
@コマ落ち反復(BPM)
226-
--information:コマ落ち反復(BPM)@Basic_S v1.72-beta3 (for beta26) by σ軸
227+
--information:コマ落ち反復(BPM)@Basic_S v1.72-beta4 (for beta26) by σ軸
227228
--label:Basic_S\コマ落ち
228229
--twopoint
229230
--param:周期(BPM),120
@@ -233,7 +234,7 @@ if 1 / N < 0 then t, N = t - gp("time", 1) - 1 / gp("framerate"), -N end
233234
return gp(((t * N / 60) % 1) < 0.5 and 0 or 1);
234235

235236
@コマ落ちランダム(秒)
236-
--information:コマ落ち反復(秒)@Basic_S v1.72-beta3 (for beta26) by σ軸
237+
--information:コマ落ち反復(秒)@Basic_S v1.72-beta4 (for beta26) by σ軸
237238
--label:Basic_S\コマ落ち
238239
--twopoint
239240
--param:周期(秒),0.5
@@ -245,7 +246,7 @@ local v0, v1 = gp(0), gp(1);
245246
return v0 + (v1 - v0) * rand1(2525, math.floor(t / T) + 1);
246247

247248
@コマ落ちランダム(フレーム)
248-
--information:コマ落ち反復(フレーム)@Basic_S v1.72-beta3 (for beta26) by σ軸
249+
--information:コマ落ち反復(フレーム)@Basic_S v1.72-beta4 (for beta26) by σ軸
249250
--label:Basic_S\コマ落ち
250251
--twopoint
251252
--param:周期(フレーム),30
@@ -258,7 +259,7 @@ local v0, v1 = gp(0), gp(1);
258259
return v0 + (v1 - v0) * rand1(2525, math.floor(f / F) + 1);
259260

260261
@コマ落ちランダム(Hz)
261-
--information:コマ落ち反復(Hz)@Basic_S v1.72-beta3 (for beta26) by σ軸
262+
--information:コマ落ち反復(Hz)@Basic_S v1.72-beta4 (for beta26) by σ軸
262263
--label:Basic_S\コマ落ち
263264
--twopoint
264265
--param:周期(Hz),2
@@ -269,7 +270,7 @@ local v0, v1 = gp(0), gp(1);
269270
return v0 + (v1 - v0) * rand1(2525, math.floor(t * N) + 1);
270271

271272
@コマ落ちランダム(BPM)
272-
--information:コマ落ち反復(BPM)@Basic_S v1.72-beta3 (for beta26) by σ軸
273+
--information:コマ落ち反復(BPM)@Basic_S v1.72-beta4 (for beta26) by σ軸
273274
--label:Basic_S\コマ落ち
274275
--twopoint
275276
--param:周期(BPM),120
@@ -280,7 +281,7 @@ local v0, v1 = gp(0), gp(1);
280281
return v0 + (v1 - v0) * rand1(2525, math.floor(t * N / 60) + 1);
281282

282283
@時間制御繰り返し(秒)
283-
--information:時間制御繰り返し(秒)@Basic_S v1.72-beta3 (for beta26) by σ軸
284+
--information:時間制御繰り返し(秒)@Basic_S v1.72-beta4 (for beta26) by σ軸
284285
--label:Basic_S\繰り返し
285286
--twopoint
286287
--param:周期(秒),0.5
@@ -294,7 +295,7 @@ local v0, v1 = gp(0), gp(1);
294295
return v0 + (v1 - v0) * gp("timecontrol", "value", ((t / T) % 1) * T1);
295296

296297
@時間制御繰り返し(フレーム)
297-
--information:時間制御繰り返し(フレーム)@Basic_S v1.72-beta3 (for beta26) by σ軸
298+
--information:時間制御繰り返し(フレーム)@Basic_S v1.72-beta4 (for beta26) by σ軸
298299
--label:Basic_S\繰り返し
299300
--twopoint
300301
--param:周期(フレーム),30
@@ -308,7 +309,7 @@ local v0, v1 = gp(0), gp(1);
308309
return v0 + (v1 - v0) * gp("timecontrol", "value", ((f / F) % 1) * T1);
309310

310311
@時間制御繰り返し(Hz)
311-
--information:時間制御繰り返し(Hz)@Basic_S v1.72-beta3 (for beta26) by σ軸
312+
--information:時間制御繰り返し(Hz)@Basic_S v1.72-beta4 (for beta26) by σ軸
312313
--label:Basic_S\繰り返し
313314
--twopoint
314315
--param:周期(Hz),2
@@ -321,7 +322,7 @@ local v0, v1 = gp(0), gp(1);
321322
return v0 + (v1 - v0) * gp("timecontrol", "value", ((t * N) % 1) * T1);
322323

323324
@時間制御繰り返し(BPM)
324-
--information:時間制御繰り返し(BPM)@Basic_S v1.72-beta3 (for beta26) by σ軸
325+
--information:時間制御繰り返し(BPM)@Basic_S v1.72-beta4 (for beta26) by σ軸
325326
--label:Basic_S\繰り返し
326327
--twopoint
327328
--param:周期(BPM),120
@@ -334,7 +335,7 @@ local v0, v1 = gp(0), gp(1);
334335
return v0 + (v1 - v0) * gp("timecontrol", "value", ((t * N / 60) % 1) * T1);
335336

336337
@対数補間
337-
--information:対数補間@Basic_S v1.72-beta3 (for beta26) by σ軸
338+
--information:対数補間@Basic_S v1.72-beta4 (for beta26) by σ軸
338339
--label:Basic_S\特殊補間
339340
--timecontrol
340341
local gp, math = obj.getpoint, math;
@@ -349,12 +350,13 @@ end
349350
return v0 * (v1 / v0) ^ t;
350351

351352
@対数補間(全体時間制御)
352-
--information:対数補間(全体時間制御)@Basic_S v1.72-beta3 (for beta26) by σ軸
353+
--information:対数補間(全体時間制御)@Basic_S v1.72-beta4 (for beta26) by σ軸
353354
--label:Basic_S\特殊補間
354355
--timecontrol
355356
local gp, math = obj.getpoint, math;
356357
local n, i, t = gp("num"), math.modf(gp("timecontrol", "index"));
357-
if i >= n - 1 then i, t = n - 2, 1 end
358+
if i >= n - 1 then i, t = n - 2, 1;
359+
elseif i < 0 then i, t = 0, 0 end
358360
local v0, v1 = gp(i), gp(i + 1);
359361
if v0 == 0 or v1 == 0 or (v0 > 0) ~= (v1 > 0) then
360362
-- fall back to the linear interpolation instead.
@@ -363,7 +365,7 @@ end
363365
return v0 * (v1 / v0) ^ t;
364366

365367
@逆数補間
366-
--information:逆数補間@Basic_S v1.72-beta3 (for beta26) by σ軸
368+
--information:逆数補間@Basic_S v1.72-beta4 (for beta26) by σ軸
367369
--label:Basic_S\特殊補間
368370
--timecontrol
369371
local gp, math = obj.getpoint, math;
@@ -378,12 +380,13 @@ end
378380
return 1 / (1 / v0 + (1 / v1 - 1 / v0) * t);
379381

380382
@逆数補間(全体時間制御)
381-
--information:逆数補間(全体時間制御)@Basic_S v1.72-beta3 (for beta26) by σ軸
383+
--information:逆数補間(全体時間制御)@Basic_S v1.72-beta4 (for beta26) by σ軸
382384
--label:Basic_S\特殊補間
383385
--timecontrol
384386
local gp, math = obj.getpoint, math;
385387
local n, i, t = gp("num"), math.modf(gp("timecontrol", "index"));
386-
if i >= n - 1 then i, t = n - 2, 1 end
388+
if i >= n - 1 then i, t = n - 2, 1;
389+
elseif i < 0 then i, t = 0, 0 end
387390
local v0, v1 = gp(i), gp(i + 1);
388391
if v0 == 0 or v1 == 0 or (v0 > 0) ~= (v1 > 0) then
389392
-- fall back to the linear interpolation instead.
@@ -392,7 +395,7 @@ end
392395
return 1 / (1 / v0 + (1 / v1 - 1 / v0) * t);
393396

394397
@バウンス
395-
--information:バウンス@Basic_S v1.72-beta3 (for beta26) by σ軸
398+
--information:バウンス@Basic_S v1.72-beta4 (for beta26) by σ軸
396399
--label:Basic_S
397400
--speed:0,1
398401
--param:反発係数,0.70710678
@@ -425,15 +428,16 @@ local rho = 4 * tau * (scale - tau);
425428
return v0 + (v1 - v0) * rho;
426429

427430
@バウンス(全体時間制御)
428-
--information:バウンス(全体時間制御)@Basic_S v1.72-beta3 (for beta26) by σ軸
431+
--information:バウンス(全体時間制御)@Basic_S v1.72-beta4 (for beta26) by σ軸
429432
--label:Basic_S
430433
--speed:0,1
431434
--param:反発係数,0.70710678
432435
--param:回数,0
433436
--timecontrol
434437
local gp, math = obj.getpoint, math;
435438
local n, i, t = gp("num"), math.modf(gp("timecontrol", "index"));
436-
if i >= n - 1 then i, t = n - 2, 1 end
439+
if i >= n - 1 then i, t = n - 2, 1;
440+
elseif i < 0 then i, t = 0, 0 end
437441
local v0, v1, sp0, sp1 = gp(i), gp(i + 1), gp("accelerate"), gp("decelerate");
438442
if sp0 == sp1 then
439443
if t < 0.5 then t, v1, sp1 = 2 * t, (v0 + v1) / 2, not sp1;
@@ -457,7 +461,7 @@ local rho = 4 * tau * (scale - tau);
457461
return v0 + (v1 - v0) * rho;
458462

459463
@バック
460-
--information:バック@Basic_S v1.72-beta3 (for beta26) by σ軸
464+
--information:バック@Basic_S v1.72-beta4 (for beta26) by σ軸
461465
--label:Basic_S
462466
--speed:0,1
463467
--param:勢い,0.8
@@ -479,14 +483,15 @@ local rho = t ^ 3 - t * a * math.sin(math.pi * t);
479483
return v0 + (v1 - v0) * rho;
480484

481485
@バック(全体時間制御)
482-
--information:バック(全体時間制御)@Basic_S v1.72-beta3 (for beta26) by σ軸
486+
--information:バック(全体時間制御)@Basic_S v1.72-beta4 (for beta26) by σ軸
483487
--label:Basic_S
484488
--speed:0,1
485489
--param:勢い,0.8
486490
--timecontrol
487491
local gp, math = obj.getpoint, math;
488492
local n, i, t = gp("num"), math.modf(gp("timecontrol", "index"));
489-
if i >= n - 1 then i, t = n - 2, 1 end
493+
if i >= n - 1 then i, t = n - 2, 1;
494+
elseif i < 0 then i, t = 0, 0 end
490495
local v0, v1, sp0, sp1 = gp(i), gp(i + 1), gp("accelerate"), gp("decelerate");
491496
if sp0 == sp1 then
492497
if t < 0.5 then t, v1, sp1 = 2 * t, (v0 + v1) / 2, not sp1;
@@ -500,7 +505,7 @@ local rho = t ^ 3 - t * a * math.sin(math.pi * t);
500505
return v0 + (v1 - v0) * rho;
501506

502507
@バネ振動
503-
--information:バネ振動@Basic_S v1.72-beta3 (for beta26) by σ軸
508+
--information:バネ振動@Basic_S v1.72-beta4 (for beta26) by σ軸
504509
--label:Basic_S
505510
--speed:0,1
506511
--param:振動回数,3
@@ -526,15 +531,16 @@ local rho = r * math.sin(2 * math.pi * ((n + 0.25) * (1 - t) + 0.25));
526531
return v0 + (v1 - v0) * rho;
527532

528533
@バネ振動(全体時間制御)
529-
--information:バネ振動(全体時間制御)@Basic_S v1.72-beta3 (for beta26) by σ軸
534+
--information:バネ振動(全体時間制御)@Basic_S v1.72-beta4 (for beta26) by σ軸
530535
--label:Basic_S
531536
--speed:0,1
532537
--param:振動回数,3
533538
--param:減衰率,0.3
534539
--timecontrol
535540
local gp, math = obj.getpoint, math;
536541
local n, i, t = gp("num"), math.modf(gp("timecontrol", "index"));
537-
if i >= n - 1 then i, t = n - 2, 1 end
542+
if i >= n - 1 then i, t = n - 2, 1;
543+
elseif i < 0 then i, t = 0, 0 end
538544
local v0, v1, sp0, sp1 = gp(i), gp(i + 1), gp("accelerate"), gp("decelerate");
539545
if sp0 == sp1 then
540546
if t < 0.5 then t, v1, sp1 = 2 * t, (v0 + v1) / 2, not sp1;
@@ -549,4 +555,3 @@ r = (r > 0 or t < 1) and r >= 1 and t or (r ^ (1 - t) - r) / (1 - r) or 1;
549555
local rho = r * math.sin(2 * math.pi * ((n + 0.25) * (1 - t) + 0.25));
550556

551557
return v0 + (v1 - v0) * rho;
552-

0 commit comments

Comments
 (0)