Rotación

Los objetos rotan con respecto al origen del lienzo (esquina superior izquierda), si desea que giren con respecto a otro punto primero hay que trasladarlo.

var ce = Cevent("canvas");

var origen = ce.rect(100, 100, 50).attr("fill", "green").get(-1),

    corner = ce.rect(0, 0, 50).attr("fill", "orangered")
                              .translate(250, 100).get(-1);

    center = ce.rect(-25, -25, 50).attr("fill", "gray")
                                  .translate(400, 100).get(-1);

ce.loop(function(){
    origen.rotation += 1;
    center.rotation += 1;
    corner.rotation += 1;
});

Related Topics

This Page

Fork me on GitHub