本文介绍了HTML5 Canvas,smoothZoom的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序是在asp.net MVC3中,我遇到了SmoothZoom和HTML5 Canvas的问题。当我激活缩放时,画布图像将会消失。

My application is in asp.net MVC3 and I am having a problem with SmoothZoom and HTML5 Canvas.When I activate the zoom, the canvas image will be disappear.

这是我的代码:

显示图像:

<div id="Div1" style="position: relative; width: 256px; height: 256px">
<img id="Image2" src="<%= ViewBag.IMG2 %>" alt="image" height="256" width="256" />
<canvas id="canvas6" style="z-index: 1; position: absolute; left: 0px; top: 0px;"
height="256px" width="256px">
This text is displayed if your browser does not support HTML5 Canvas.
</canvas>
</div>

   function drawCanvas1() {

            canvas6 = document.getElementById("canvas6");
            ctx6 = canvas6.getContext("2d");

            ctx6.clearRect(0, 0, WIDTH1, HEIGHT1);
            var img = new Image();
            img.onload = function () {
                ctx6.drawImage(img, 200, 20);
            }
            img.src = "../../Content/images/l.png";
        }

激活smoothzoom:

To activate smoothzoom:

  function zoomMPR() {
            $('#Image2').smoothZoom({
                width: 256,
                height: 256,
                zoom: 5,
                speed: 1
            });


推荐答案

我可能不明白你所说的但是

I may not understand what u said but try this link may b useful for u

这篇关于HTML5 Canvas,smoothZoom的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-24 06:25