@pilotlab/lux-attributes
Version:
A luxurious user experience framework, developed by your friends at Pilot.
36 lines (29 loc) • 1.01 kB
text/typescript
import { DataType } from '../attributeEnums';
import {
Attribute,
AttributeChangeActions,
AttributeChangeOptions,
IAttributeChangeOptions,
IAttributeUpdateTracker
} from '@pilotlab/lux-attributes';
import {
IAnimationEaseFunction,
ISpeed
} from '@pilotlab/lux-animation';
export class AttributeDouble extends Attribute {
constructor(key:string, value:number = 0.0, label?:string) {
super(key, value, DataType.NUMBER_DOUBLE, label);
this.validate = (value:any) => { return parseFloat(value); };
}
go(
target:number,
durationSpeed?:(number | ISpeed),
ease?:IAnimationEaseFunction,
repeatCount:number = 0
):IAttributeUpdateTracker {
const options:IAttributeChangeOptions = new AttributeChangeOptions(AttributeChangeActions.SIGNAL_CHANGE, durationSpeed, ease);
options.repeatCount = repeatCount;
return this.attributes.update(target, options);
}
} // End class
export default AttributeDouble;