代码之家  ›  专栏  ›  技术社区  ›  Alan

使用react konva翻转图像

  •  1
  • Alan  · 技术社区  · 8 年前

    具有 https://github.com/lavrton/react-konva

    如何翻转图像(水平或垂直) 我正在使用此功能,但它不起作用:

      flip = direction => {
        this.setState({
          width: -this.state.width
        })
      }
    
    1 回复  |  直到 7 年前
        1
  •  3
  •   lavrton    8 年前

    最好使用比例特性:

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

    所以在你的州,你应该 scale 具有1或-1值的属性,

    https://codesandbox.io/s/v6yk2j2w0l