Giter VIP home page Giter VIP logo

alloyrenderingengine's Introduction

AlloyRenderingEngine

合金渲染引擎,使用webgl超速渲染2d, 使用canvas 2d向下兼容

Quick start

Demos

Usage

To achieve this effect:

usage

You need to use the following code:

var ld = new Loader(), stage = new Stage("#ourCanvas", localStorage.webgl == "1"), bmp;
ld.loadRes([
    { id: "atLogo", src: "../asset/img/atLogo.png" }
]);
ld.complete(function () {
    bmp = new Bitmap(ld.get("atLogo"));
    //(0.5,0.5)==〉The center is the point of rotation
    bmp.originX = 0.5;
    bmp.originY = 0.5;
    bmp.x = 240;
    bmp.y = 240;
    //bind click event, the event monitor can be accurate to pixel
    bmp.on("click", function () {
        //apply a random filter to the bmp
        bmp.setFilter(Math.random(), Math.random(), Math.random(), 1);
    })
    //add object to stage
    stage.add(bmp);
           
    var step = 0.01;
    //loop
    stage.onTick(function () {
        bmp.rotation += 0.5;
        if (bmp.scaleX > 1.5||bmp.scaleX < 0.5) {
            step *= -1;
        }
        bmp.scaleX += step;
        bmp.scaleY += step;
    })
});

This content is released under the (http://opensource.org/licenses/MIT) MIT License.

alloyrenderingengine's People

Watchers

James Cloos avatar 沫苓小怪 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.