Giter Site home page Giter Site logo

Comments (6)

wumail avatar wumail commented on June 16, 2024

我理解你在自定义节点里自行通过字段控制边的样式就能实现你的需求了

from logicflow.

WangJincheng4869 avatar WangJincheng4869 commented on June 16, 2024

我理解你在自定义节点里自行通过字段控制边的样式就能实现你的需求了

但是当我开启动画的时候,会覆盖掉我自定义的样式
image

/**
 * 自定义直角折线边
 */
class SpPolylineEdgeModel extends PolylineEdgeModel {
  createId(): string {
    return nanoid();
  }

  setAttributes() {
    this.isAnimation = true;
  }

  getEdgeStyle() {
    const style = super.getEdgeStyle();
    const { properties } = this;
    if (properties.isActived) {
      style.strokeDasharray = '4 4';
    }
    style.stroke = 'orange';
    return style;
  }
}

from logicflow.

wumail avatar wumail commented on June 16, 2024

我理解你在自定义节点里自行通过字段控制边的样式就能实现你的需求了

但是当我开启动画的时候,会覆盖掉我自定义的样式 image

/**
 * 自定义直角折线边
 */
class SpPolylineEdgeModel extends PolylineEdgeModel {
  createId(): string {
    return nanoid();
  }

  setAttributes() {
    this.isAnimation = true;
  }

  getEdgeStyle() {
    const style = super.getEdgeStyle();
    const { properties } = this;
    if (properties.isActived) {
      style.strokeDasharray = '4 4';
    }
    style.stroke = 'orange';
    return style;
  }
}

动画的样式也可以自定义

from logicflow.

WangJincheng4869 avatar WangJincheng4869 commented on June 16, 2024

我理解你在自定义节点里自行通过字段控制边的样式就能实现你的需求了

但是当我开启动画的时候,会覆盖掉我自定义的样式 image

/**
 * 自定义直角折线边
 */
class SpPolylineEdgeModel extends PolylineEdgeModel {
  createId(): string {
    return nanoid();
  }

  setAttributes() {
    this.isAnimation = true;
  }

  getEdgeStyle() {
    const style = super.getEdgeStyle();
    const { properties } = this;
    if (properties.isActived) {
      style.strokeDasharray = '4 4';
    }
    style.stroke = 'orange';
    return style;
  }
}

动画的样式也可以自定义啊

仅自定义动画没有找到办法实现我想要的效果,因为动画中点的宽度是要比边宽的,是覆盖在边上的动画。
我查了一下 polyline 的 API,没有找到合适的办法,目前想到的办法就是动画边和边分离,动画边可以覆盖到边上面。
类似这种效果:
动画

from logicflow.

wumail avatar wumail commented on June 16, 2024

我理解你在自定义节点里自行通过字段控制边的样式就能实现你的需求了

但是当我开启动画的时候,会覆盖掉我自定义的样式 image

/**
 * 自定义直角折线边
 */
class SpPolylineEdgeModel extends PolylineEdgeModel {
  createId(): string {
    return nanoid();
  }

  setAttributes() {
    this.isAnimation = true;
  }

  getEdgeStyle() {
    const style = super.getEdgeStyle();
    const { properties } = this;
    if (properties.isActived) {
      style.strokeDasharray = '4 4';
    }
    style.stroke = 'orange';
    return style;
  }
}

动画的样式也可以自定义啊

仅自定义动画没有找到办法实现我想要的效果,因为动画中点的宽度是要比边宽的,是覆盖在边上的动画。 我查了一下 polyline 的 API,没有找到合适的办法,目前想到的办法就是动画边和边分离,动画边可以覆盖到边上面。 类似这种效果: 动画

https://developer.mozilla.org/zh-CN/docs/Web/SVG/SVG_animation_with_SMIL SMIL动画应该也可以实现
SMIL路径动画例子:https://svg-animation-booklet.vercel.app/chapter6.html#svg-smil-animation
需要继承Polyline自定义边,重写getEdge方法

from logicflow.

boyongjiong avatar boyongjiong commented on June 16, 2024

上面提供了解决方案,目前不会就这个功能开发 feature,故先将此 issue 关闭

from logicflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.