如何在画布上更改图像? [英] How I Can Change Image On Canvas ?

查看:91
本文介绍了如何在画布上更改图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请告诉我如何更改画布上的图像,我在一个网页上有2个画布,如何在单击按钮时更改图像。两个画布填充图像????

plz tell me how i can change the image on canvass, i have 2 canvas on a single webpage, how i change the image on clicking the button . both canvas fill with image ????

推荐答案




看来这段代码是拼凑而成的码。您正在调用var canvas两次并尝试一起打印图像。如果您想更好地了解工作原理,请查看:

http:// www.w3schools.com/html/html5_canvas.asp [ ^ ]

http://www.w3schools.com/js/js_functions.asp [ ^ ]

从基础开始,然后继续工作。



但是,如果你觉得你可以从中途开始做这个,请看看这个提示/诀窍

使用JavaScript的图像滑动效果 [< a href =http://www.codeproject.com/Tips/670085/Image-Sliding-Effect-with-JavaScripttarget =_ blanktitle =New Window> ^ ]并使其适应点击而不是计时器。如果它看起来很难做,那么也许你应该在前2个链接上查看和练习。



祝你好运



问候
Hi
It seems that this code was patch together from pieces of code. You are calling var canvas twice and are try to print images all together. If you want to better understand how things work, please have a look at:
http://www.w3schools.com/html/html5_canvas.asp[^]
http://www.w3schools.com/js/js_functions.asp[^]
Start from the basic and work your way up.

However, if you feel like you can do this starting from half way, have a look on this Tip/Trick
Image Sliding Effect with JavaScript[^] and adapt it to clicking instead of the timer. If it looks to difficult to do it, then maybe you should look and practice at the first 2 links.

Good Luck

Regards


这篇关于如何在画布上更改图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆