mirror of
https://github.com/molstar/molstar.git
synced 2026-06-04 13:30:24 +08:00
add time only animation for exporting
This commit is contained in:
25
src/mol-plugin-state/animation/built-in/time.ts
Normal file
25
src/mol-plugin-state/animation/built-in/time.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Copyright (c) 2026 mol* contributors, licensed under MIT, See LICENSE file for more info.
|
||||
*
|
||||
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
||||
*/
|
||||
|
||||
import { ParamDefinition as PD } from '../../../mol-util/param-definition';
|
||||
import { PluginStateAnimation } from '../model';
|
||||
|
||||
export const AnimateTime = PluginStateAnimation.create({
|
||||
name: 'built-in.animate-time',
|
||||
display: { name: 'Animate Time', description: 'Animate the passage of time in the 3D scene' },
|
||||
isExportable: true,
|
||||
params: () => ({
|
||||
durationInMs: PD.Numeric(4000, { min: 100, max: 20000, step: 100 }),
|
||||
}),
|
||||
initialState: () => ({ }),
|
||||
getDuration: p => ({ kind: 'fixed', durationMs: p.durationInMs }),
|
||||
|
||||
async apply(animState, t, ctx) {
|
||||
return t.current < ctx.params.durationInMs
|
||||
? { kind: 'next', state: animState }
|
||||
: { kind: 'finished' };
|
||||
}
|
||||
});
|
||||
@@ -24,6 +24,7 @@ import { BoxifyVolumeStreaming, CreateVolumeStreamingBehavior, InitVolumeStreami
|
||||
import { AnimateStateInterpolation } from '../mol-plugin-state/animation/built-in/state-interpolation';
|
||||
import { AnimateStructureSpin } from '../mol-plugin-state/animation/built-in/spin-structure';
|
||||
import { AnimateCameraRock } from '../mol-plugin-state/animation/built-in/camera-rock';
|
||||
import { AnimateTime } from '../mol-plugin-state/animation/built-in/time';
|
||||
|
||||
export { PluginSpec };
|
||||
|
||||
@@ -145,6 +146,7 @@ export const DefaultPluginSpec = (): PluginSpec => ({
|
||||
AnimateStateSnapshotTransition,
|
||||
AnimateAssemblyUnwind,
|
||||
AnimateStructureSpin,
|
||||
AnimateStateInterpolation
|
||||
AnimateStateInterpolation,
|
||||
AnimateTime
|
||||
]
|
||||
});
|
||||
Reference in New Issue
Block a user