UNPKG

@threlte/theatre

Version:

Threlte Components for Theatre, an animation library with a professional motion design toolset

13 lines (12 loc) 551 B
import { types } from '../../../theatre'; import { createTransformer } from '../createTransformer'; import { BackSide, DoubleSide, FrontSide } from 'three'; export const side = createTransformer({ transform(value) { // TODO: Fix this type error return types.stringLiteral(value === FrontSide ? 'f' : value === BackSide ? 'b' : 'd', { f: 'Front', b: 'Back', d: 'Double' }, { as: 'switch' }); }, apply(target, path, value) { target[path] = value === 'f' ? FrontSide : value === 'b' ? BackSide : DoubleSide; } });