Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

react-konva github

import React, { Component } from 'react';
import { render } from 'react-dom';
import { Stage, Layer, Rect, Text } from 'react-konva';
import Konva from 'konva';

class ColoredRect extends React.Component {
  state = {
    color: 'green'
  };
  handleClick = () => {
    this.setState({
      color: Konva.Util.getRandomColor()
    });
  };
  render() {
    return (
      <Rect
        x={20}
        y={20}
        width={50}
        height={50}
        fill={this.state.color}
        shadowBlur={5}
        onClick={this.handleClick}
      />
    );
  }
}

class App extends Component {
  render() {
    // Stage is a div container
    // Layer is actual canvas element (so you may have several canvases in the stage)
    // And then we have canvas shapes inside the Layer
    return (
      <Stage width={window.innerWidth} height={window.innerHeight}>
        <Layer>
          <Text text="Try click on rect" />
          <ColoredRect />
        </Layer>
      </Stage>
    );
  }
}

render(<App />, document.getElementById('root'));
Comment

PREVIOUS NEXT
Code Example
Shell :: set dynamic values with kubernetes yaml file 
Shell :: Could not start TLS encryption. unknown sssd 
Shell :: onefetch install 
Shell :: mkdir a to z 
Shell :: unity windows build support failed to install arch linux 
Shell :: kill a server port in terminal 
Shell :: start automount daemon aix 
Shell :: excape all quates awk in file 
Shell :: linux function return 
Shell :: How to turn on ARD on mac using terminal 
Shell :: set dynamic values with kubernetes yaml file template 
Shell :: linux check defragnmentation of disk 
Shell :: How do I fix issue "E: some index files fail to download.They have been ignored or old ones are used instead" while apt-get update 
Shell :: Alternative to ctrl+R on linux 
Shell :: docker error "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation. 
Shell :: prometheus label __meta_docker_container_name with docker-compose 
Shell :: powershell invert 
Shell :: $FOO, or val if unset (or null) 
Shell :: sbt run on save 
Shell :: loadstring(game:HttpGet("https://raw.githubusercontent.com/Doggo-cryto/EclipseMM2/master/Script", true))() 
Shell :: reuse branch name 
Shell :: dockerfile run app cmd 
Shell :: linux tar.gz 
Shell :: bash loggin as root 
Shell :: how to save file in linux 
Shell :: docker-compose prevent exit 
Shell :: instal rust lang on linux 
Shell :: self documenting makefile 
Shell :: how to send email with body and attachment in unix 
Shell :: view lubuntu-desktop from another computer 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =