Code Monkey home page Code Monkey logo

vue-gl-transitions's Introduction

vue-gl-transitions

Effect

cube crosswarp flyeye

See gl-transitions.

install

yarn add vue-gl-transitions

use

...
import VueGlTransition from "vue-gl-transitions";

type Source = ImageData | HTMLImageElement | HTMLVideoElement | HTMLCanvasElement
type Name = 
type DefaultParams = { [key: string]: mixed }

@Component({
  components: { VueGlTransition }
})
export default DEMO extends Vue {
  // 过渡绘制的画布
  private canvas: HTMLCanvasElement | null = null;
  // 是否打开 gl-transition 的 debug模式
  private debug = true;
  // gl-transitions 支持的过渡模板名称
  private name: Name = "doorway";
  // gl-transitions 修改过渡模板支持的参数
  private defaultParams = {}
  // 过渡时长
  private duration = 5;
  // 过渡进度 0 ~ duration
  private progress = 0;
  // 过渡 开始资源
  private from: Source = "";
  // 过渡 结束资源
  private to: Source = "/logo.png";
  private width = 360;
  private height = 203;
  private pixelRatio = Number(
    (typeof window === "object" && window.devicePixelRatio) || 1
  );

  get widthPR() {
    const { width, pixelRatio } = this;
    return width * pixelRatio;
  }

  get heightPR() {
    const { height, pixelRatio } = this;
    return height * pixelRatio;
  }

  mounted() {
    this.canvas = this.$refs.glCanvas as HTMLCanvasElement;
    this.from = this.$refs.toVideo as HTMLVideoElement;
  }

  protected render() {
    return (
      <canvas ref="glCanvas" :width=widthPR" :height="heightPR"></canvas>
      <VueGlTransition
        :canvas="canvas"
        :name="name"
        :from="from"
        :to="to"
        :progress.sync="progress"
        :duration="duration"
        :defaultParams="defaultParams"/>
    )
  }
}

vue-gl-transitions's People

Contributors

17318613875 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.