@pilotlab/lux-attributes
Version:
A luxurious user experience framework, developed by your friends at Pilot.
39 lines (30 loc) • 1.06 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 AttributeInt extends Attribute {
constructor(key:string, value:number = 0, label?:string) {
super(key, value, DataType.NUMBER_INT, label);
this.validate = (value:any) => { return parseInt(value); };
}
get value():number { return Math.round(this.p_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 AttributeInt;