How to use the @swim/length.Length.fromAny function in @swim/length

To help you get started, we’ve selected a few @swim/length examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github swimos / swim / swim-js / swim-ui-js / @swim / view / main / attribute / LengthOrStringAttributeAnimator.ts View on Github external
let _this: LengthOrStringAttributeAnimator = function (value?: AnyLength | string | null, tween?: Tween): Length | string | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          if (typeof value === "string") {
            try {
              value = Length.parse(value, _this._view._node);
            } catch (swallow) {
              // string value
            }
          } else {
            value = Length.fromAny(value, _this._view._node);
          }
        }
        _this.setState(value, tween);
        return _this._view;
      }
    } as LengthOrStringAttributeAnimator;
    (_this as any).__proto__ = this;
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / style / LengthOrStringStyleAnimator.ts View on Github external
let _this: LengthOrStringStyleAnimator = function (value?: AnyLength | string | null, tween?: Tween, priority?: string | null): Length | string | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          if (typeof value === "string") {
            try {
              value = Length.parse(value, _this._view._node);
            } catch (swallow) {
              // string value
            }
          } else {
            value = Length.fromAny(value, _this._view._node);
          }
        }
        _this.setState(value, tween, priority);
        return _this._view;
      }
    } as LengthOrStringStyleAnimator;
    (_this as any).__proto__ = this;
github swimos / swim / swim-system-js / swim-ui-js / @swim / shape / main / ArcView.ts View on Github external
static from(innerRadius: AnyLength = Length.zero(),
              outerRadius: AnyLength = Length.zero(),
              startAngle: AnyAngle = Angle.zero(),
              sweepAngle: AnyAngle = Angle.zero(),
              padAngle: AnyAngle = Angle.zero(),
              padRadius: AnyLength | null = null,
              cornerRadius: AnyLength = Length.zero(),
              fill?: AnyColor | null,
              stroke?: AnyColor | null,
              strokeWidth?: AnyLength | null): ArcView {
    innerRadius = Length.fromAny(innerRadius);
    outerRadius = Length.fromAny(outerRadius);
    startAngle = Angle.fromAny(startAngle);
    sweepAngle = Angle.fromAny(sweepAngle);
    padAngle = Angle.fromAny(padAngle);
    padRadius = padRadius !== null ? Length.fromAny(padRadius) : null;
    cornerRadius = Length.fromAny(cornerRadius);
    const view = new ArcView(innerRadius, outerRadius, startAngle, sweepAngle,
                             padAngle, padRadius, cornerRadius);
    if (fill !== void 0) {
      view.fill(fill);
    }
    if (stroke !== void 0) {
      view.stroke(stroke);
    }
    if (strokeWidth !== void 0) {
      view.strokeWidth(strokeWidth);
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / member / LengthMemberAnimator.ts View on Github external
let _this: LengthMemberAnimator = function (value?: AnyLength | null, tween?: Tween): Length | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          value = Length.fromAny(value);
        }
        _this.setState(value, tween);
        return _this._view;
      }
    } as LengthMemberAnimator;
    (_this as any).__proto__ = this;
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / style / LengthStyleAnimator.ts View on Github external
let _this: LengthStyleAnimator = function (value?: AnyLength | null, tween?: Tween, priority?: string | null): Length | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          value = Length.fromAny(value, view._node);
        }
        _this.setState(value, tween, priority);
        return _this._view;
      }
    } as LengthStyleAnimator;
    (_this as any).__proto__ = this;
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / attribute / LengthAttributeAnimator.ts View on Github external
let _this: LengthAttributeAnimator = function (value?: AnyLength | null, tween?: Tween): Length | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          value = Length.fromAny(value, _this._view._node);
        }
        _this.setState(value, tween);
        return _this._view;
      }
    } as LengthAttributeAnimator;
    (_this as any).__proto__ = this;
github swimos / swim / swim-system-js / swim-ui-js / @swim / view / main / member / LengthMemberAnimator.ts View on Github external
this: LengthMemberAnimator, view: V, value?: AnyLength | null,
      transition?: Transition | null, inherit?: string | null): LengthMemberAnimator {
    let _this: LengthMemberAnimator = function (value?: AnyLength | null, tween?: Tween): Length | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          value = Length.fromAny(value);
        }
        _this.setState(value, tween);
        return _this._view;
      }
    } as LengthMemberAnimator;
    (_this as any).__proto__ = this;
    if (value !== null && value !== void 0) {
      value = Length.fromAny(value);
    }
    _this = _super.call(_this, view, value, transition, inherit) || _this;
    return _this;
  } as unknown as MemberAnimatorConstructor;
  __extends(LengthMemberAnimator, _super);
github swimos / swim / swim-system-js / swim-ui-js / @swim / shape / main / ArcView.ts View on Github external
outerRadius: AnyLength = Length.zero(),
              startAngle: AnyAngle = Angle.zero(),
              sweepAngle: AnyAngle = Angle.zero(),
              padAngle: AnyAngle = Angle.zero(),
              padRadius: AnyLength | null = null,
              cornerRadius: AnyLength = Length.zero(),
              fill?: AnyColor | null,
              stroke?: AnyColor | null,
              strokeWidth?: AnyLength | null): ArcView {
    innerRadius = Length.fromAny(innerRadius);
    outerRadius = Length.fromAny(outerRadius);
    startAngle = Angle.fromAny(startAngle);
    sweepAngle = Angle.fromAny(sweepAngle);
    padAngle = Angle.fromAny(padAngle);
    padRadius = padRadius !== null ? Length.fromAny(padRadius) : null;
    cornerRadius = Length.fromAny(cornerRadius);
    const view = new ArcView(innerRadius, outerRadius, startAngle, sweepAngle,
                             padAngle, padRadius, cornerRadius);
    if (fill !== void 0) {
      view.fill(fill);
    }
    if (stroke !== void 0) {
      view.stroke(stroke);
    }
    if (strokeWidth !== void 0) {
      view.strokeWidth(strokeWidth);
    }
    return view;
  }
github swimos / swim / swim-system-js / swim-ui-js / @swim / view / main / member / LengthMemberAnimator.ts View on Github external
let _this: LengthMemberAnimator = function (value?: AnyLength | null, tween?: Tween): Length | null | undefined | V {
      if (value === void 0) {
        return _this.value;
      } else {
        if (value !== null) {
          value = Length.fromAny(value);
        }
        _this.setState(value, tween);
        return _this._view;
      }
    } as LengthMemberAnimator;
    (_this as any).__proto__ = this;
github swimos / swim / swim-system-js / swim-ui-js / @swim / shape / main / ArcView.ts View on Github external
static from(innerRadius: AnyLength = Length.zero(),
              outerRadius: AnyLength = Length.zero(),
              startAngle: AnyAngle = Angle.zero(),
              sweepAngle: AnyAngle = Angle.zero(),
              padAngle: AnyAngle = Angle.zero(),
              padRadius: AnyLength | null = null,
              cornerRadius: AnyLength = Length.zero(),
              fill?: AnyColor | null,
              stroke?: AnyColor | null,
              strokeWidth?: AnyLength | null): ArcView {
    innerRadius = Length.fromAny(innerRadius);
    outerRadius = Length.fromAny(outerRadius);
    startAngle = Angle.fromAny(startAngle);
    sweepAngle = Angle.fromAny(sweepAngle);
    padAngle = Angle.fromAny(padAngle);
    padRadius = padRadius !== null ? Length.fromAny(padRadius) : null;
    cornerRadius = Length.fromAny(cornerRadius);
    const view = new ArcView(innerRadius, outerRadius, startAngle, sweepAngle,
                             padAngle, padRadius, cornerRadius);
    if (fill !== void 0) {
      view.fill(fill);
    }
    if (stroke !== void 0) {
      view.stroke(stroke);
    }
    if (strokeWidth !== void 0) {
      view.strokeWidth(strokeWidth);
    }
    return view;
  }

@swim/length

DOM-relative length types with unit-aware algebraic operators, conversions, and parsers

Apache-2.0
Latest version published 5 years ago

Package Health Score

59 / 100
Full package analysis