omi/packages/omi-transform
当耐特 8c7e799c60
Update README.md
2018-11-06 17:14:11 +08:00
..
css3transform update readme 2018-10-25 12:38:26 +08:00
README.md Update README.md 2018-11-06 17:14:11 +08:00
index.js update readme 2018-10-29 10:05:17 +08:00
package.json update readme 2018-10-29 10:05:17 +08:00

README.md

omi-transform

Made css3 transform super easy.

Supported properties(get and set):

Property Describe
translateX translateX
translateY translateY
translateZ translateZ
scaleX scaleX
scaleY scaleY
scaleZ scaleZ
rotateX rotateX
rotateY rotateY
rotateZ rotateZ
skewX skewX
skewY skewY
originX the basic x point of rotation
originY the basic y point of rotation
originZ the basic z point of rotation
perspective Perspective projection distance

Usage

import { render, WeElement, tag } from "omi";
import "omi-transform";

@tag("my-app")
class MyApp extends WeElement {
  install() {
    this.data.rotateZ = 30
    this.linkRef = (e) => {
      this.animDiv = e
    }
  }

  installed() {
    setInterval(() => {
      //slow
      // this.data.rotateZ += 2
      // this.update()

      //fast
      this.animDiv.rotateZ += 2
      //sync for update call of any scenario
      this.data.rotateZ = this.animDiv.rotateZ
    }, 16)


  }
  render(props, data) {
    return (
      <css3-transform rotateZ={data.rotateZ} translateX={0} perspective={0} >
        <div ref={this.linkRef}>
          omi-transform
          </div>
      </css3-transform>
    )
  }
}

render(<my-app />, "body");

Using in pure js

var ele = document.querySelector("#test1")
Transform(element1)
element1.rotateZ = 45

Demos

License

MIT © dntzhang