SGradientStop.ts 744 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { SColor } from "./";
  2. /**
  3. * 渐变颜色节点
  4. *
  5. * @author 庞利祥(sybotan@126.com)
  6. */
  7. export class SGradientStop {
  8. /** 位置 */
  9. private _pos: number = 0;
  10. get pos(): number {
  11. return this._pos;
  12. } // Get pos
  13. set pos(value: number) {
  14. if (value < 0) {
  15. value = 0;
  16. }
  17. if (value > 1) {
  18. value = 1;
  19. }
  20. this._pos = value;
  21. } // Set pos
  22. /** 颜色 */
  23. color: SColor;
  24. /**
  25. * 构造函数
  26. *
  27. * @param pos 节点位置
  28. * @param color 节点颜色
  29. */
  30. constructor(pos: number, color: SColor) {
  31. this.pos = pos;
  32. this.color = color;
  33. } // Constructor()
  34. } // Class SGradientStop