omi/packages/omi-transform
dntzhang c0e933a1a5 css3transform v1.2.2
- change _rounded to epsilon
2019-07-08 11:46:24 +08:00
..
css3transform css3transform v1.2.2 2019-07-08 11:46:24 +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 dependencies of omi-transform 2018-11-19 11:30:12 +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