English 中文(简体)
血管和血清图像
原标题:skew and animate image on canvas

我想要在信道上sk和一丝不.的形象。 我可以借鉴《信道》的形象,但如何在绘画后sk击和清醒? • 如何参考从信库中汲取的形象?

我可以像现在这样,利用信教的形象。

var ctx = document.getElementById( canvas ).getContext( 2d );
ctx.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);
最佳回答

下面是你开始的非常粗略的草图:

$(function () {
  var
    loaded = false,
    ctx = $( canvas )[0].getContext( 2d ),
    img;

  img = $( <img> , {
    src:  http://www.gravatar.com/avatar/e25f40f6711403073e7da6c33be21eb8?s=128&d=identicon&r=PG 
  }).on( load , function () {
    loaded = true;
  }).get(0);


  setInterval(function () {
    var f = 0;

    return function () {
      if (loaded) {
        ctx.clearRect(0, 0, 500, 500);

        ctx.save();
        ctx.setTransform (1, f, 0, 1, 0, 0);
        ctx.drawImage(img, 50, 50);
        ctx.restore();

        f += 0.01;

        if (f > 1) {
          f = 0;
        }
      }
    };
  }(), 16);
});

demo:

问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签