-
Notifications
You must be signed in to change notification settings - Fork 10
串聯、並聯動畫 Clip
Pofu edited this page Nov 8, 2020
·
1 revision
依照順序播放動畫 Clip
const moveX = new PFTween(0, .1, 1000).bind(v => plane0.transform.x = v.scalar).clip;
const moveY = new PFTween(0, .1, 1000).bind(v => plane0.transform.y = v.scalar).clip;
const ani = PFTween.concat(moveX, moveY);
Diagnostics.log('begin');
await ani();
Diagnostics.log('end');
同時播放動畫 Clip
const moveX = new PFTween(0, .1, 1000).bind(v => plane0.transform.x = v.scalar).clip;
const moveY = new PFTween(0, .1, 1000).bind(v => plane0.transform.y = v.scalar).clip;
const ani = PFTween.combine(moveX, moveY);
Diagnostics.log('begin');
await ani();
Diagnostics.log('end');
串聯、並聯後的動畫可以視作一個單一 Clip,再重新加入其他串聯、並聯使用
const moveX = new PFTween(0, .1, 1000).bind(v => plane0.transform.x = v.scalar).clip;
const moveY = new PFTween(0, .1, 1000).bind(v => plane0.transform.y = v.scalar).clip;
const combine1 = PFTween.combine(moveX, moveY);
const rotZ = new PFTween(0, 180, 1000).bind(v => plane0.transform.rotationZ = v.rotation).clip;
const scale = new PFTween(1, 1.5, 1000).bind(v => plane0.transform.scale = v.pack3).clip;
const combine2 = PFTween.combine(rotZ, scale);
const concat = PFTween.concat(combine1, combine2);
Diagnostics.log('begin');
await concat();
Diagnostics.log('end');