Flip Image with react-konva

帅比萌擦擦* 提交于 2019-12-14 03:07:43

问题


With https://github.com/lavrton/react-konva

How can I flip an image (horizontally or vertically) I am using this function, but it is not working:

  flip = direction => {
    this.setState({
      width: -this.state.width
    })
  }

回答1:


It is better to use scale property:

<Image image={this.state.image} scaleY={-1} y={200}/>

So in your state, you should store scale property with 1 or -1 values,

https://codesandbox.io/s/v6yk2j2w0l



来源:https://stackoverflow.com/questions/50690175/flip-image-with-react-konva

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!