Skip to content

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

License

Notifications You must be signed in to change notification settings

xuedi2014/AlloyRenderingEngine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published