本篇文章給大家分享的是有關(guān)如何解決HTML5 Canvas圖像模糊的問題,小編覺得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。
創(chuàng)新互聯(lián)公司主營烏拉特中網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,成都app開發(fā),烏拉特中h5小程序定制開發(fā)搭建,烏拉特中網(wǎng)站營銷推廣歡迎烏拉特中等地區(qū)企業(yè)咨詢
1、最近在用h6的canvas畫動畫,發(fā)現(xiàn)圖像特別模糊。后來終于找到罪魁禍?zhǔn)资?/p>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
這個代碼,因?yàn)檫@行代碼進(jìn)行了伸縮
2、模糊圖像的效果:
3、將壓縮去掉后的效果
可以將代碼改成
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="user-scalable=no" /> <title>賽事詳細(xì)頁</title> <script src="js/rem.js" type="text/javascript" charset="utf-8"></script> <link rel="stylesheet" type="text/css" href="css/m_reset.css" /> <link rel="stylesheet" type="text/css" href="css/gameListsNew.css" /> <link href="css/mask.css" rel="stylesheet" /> </head> <body> <p class="tipMask"> <p class="tipBox"> <img src="img/faileTip.png" class="tipsImg" /> <p class="fileBtn"> <img src="img/fileBtn.png" /> <span class="tryAgain">再試一次</span> </p> </p> </p> <p> <img src="img/whiteBack.png" class="titleImg" /> <p class="bgEvent" id="contentbody"> <p id="eventDetail" v-cloak> <!--標(biāo)題--> <p class="detailevent"> <p class="titlevs"> <img class="teamFlagLogo" onerror="nofind(this);" :src="'img/teamlogonew/'+eventDetail.HomeTeamID+'.png'" /> <p class="countryName"> {{eventDetail.HomeTeamName}} </p> </p> <p class="titlevs" style="padding-top:0.3rem ;"> <p> <!--未開賽--> <!--<p class="theWorldCup">世界杯</p>--> <p class="theGameNowDataTime">{{eventDetail.TimeFormat }}</p> <p class="gameBeginTime">{{getScoreOrVs(eventDetail.HomeTeamScore,eventDetail.AwayTeamScore)}}</p> </p> <!--開賽時長--> <!--<p> <p>73:40</p> </p>--> </p> <p class="titlevs"> <img class="teamFlagLogo" onerror="nofind(this);" :src="'img/teamlogonew/'+eventDetail.AwayTeamID+'.png'" /> <p class="countryName"> {{eventDetail.AwayTeamName}} </p> </p> </p> <p id="ordersuccess" class="ordersuccess"> <p style="text-align:right;padding-top:0.2rem;padding-left:0.2rem;"> <img src="img/ordersuccess/close.png" style="width:0.45rem;height:0.45rem;" id="closesuccess" onclick="closesuccess();" /> </p> <p class="teamname"> <p class="teamnameitem"><p class="teamnameitemtop">{{eventDetail.HomeTeamName}}</p><br /><p class="teamnameitembottom">HOME</p></p> <p class="teamnameitem "><p class="teamnameitemmiddle">VS</p></p> <p class="teamnameitem"><p class="teamnameitemtop">{{eventDetail.AwayTeamName}}</p><br /><p class="teamnameitembottom">AWAY</p></p> </p> <p class="teamdetail"> <p class="teamdate"><span>{{eventDetail.CompetitionName}}</span><span>/</span><span>{{eventDetail.DateFormat}}</span></p> <p class="teamplaysselection"> <table style="width:100%;text-align:left;height:100%;"> <tr> <td class="teamplaysselectiontop" style="width:50%;">玩法</td> <td class="teamplaysselectiontop" style="width:50%;">選項(xiàng)</td> </tr> <tr> <td class="teamplaysselectionbottom" style="width:50%;" id="rulename">Match Odds</td> <td class="teamplaysselectionbottom" style="width:50%;" id="selectionname">Home</td> </tr> </table> </p> <p class="teamwinmoney"> <table style="width:90%;text-align:left;height:100%;"> <tr> <td class="teamwinmoneytop" style="width:50%;"> 本金 </td> <td class="teamwinmoneytop" style="width:50%;"> 賠率 </td> <td class="teamwinmoneytop" style="width:50%;"> 預(yù)贏 </td> </tr> <tr> <td class="teamwinmoneybottom" style="width:50%;" id="betmoneysuc">1000</td> <td class="teamwinmoneybottom" style="width:50%;" id="betodds">12.54</td> <td class="teamwinmoneybottom" style="width:50%;" id="betwin">12540</td> </tr> </table> </p> </p> </p> </p> <p> <p class="square" id="square"> <canvas id="courtCaseNew" width="980" height="765"></canvas> </p> <img src="img/balllittle.png" style="width:20px;height:20px;display:none;" id="imgballNew" /> </p> <p class="middlechat"> <p class="middleitem" id="jcc"> <p class="tabActive">競猜場</p> </p> <p class="middleitem" id="jcjl"> <p class="tabCommon">競猜記錄</p> </p> <p class="middleitem" id="sssj"> <p class="tabCommon">賽事事件</p> </p> <p class="middleitem" id="jstj"> <p class="tabCommon">技術(shù)統(tǒng)計</p> </p> </p> <p class="downChangrTab quizGames" style="display: block;"> <p id="ruleTypeItems" v-cloak> <!--勝平負(fù)--> <p class="diffPlaysTetx" v-for="(item,index) in eventDetail.Market" v-if="item.RuleType==100"> <span class="speciesName">賽果</span> <span class="rotary" v-if="item.State!=1">(已封盤)</span> <span class="speciesExp">猜90分鐘(含補(bǔ)時)兩隊(duì)的比賽結(jié)果</span> </p> <p v-for="(item,index) in eventDetail.Market" v-if="item.RuleType==100" id="result" name="selectionItems" class="result"> <p v-bind:class="[(select.BackOdds<1.01 || item.State!=1) ? 'resutitemGray commonBorderGray':'resutitem commonBorder']" v-for="(select,index) in item.Selection" v-on:click="select.BackOdds>=1.01 &&clickFun($event,item.State,select.BackOdds,item.MarketId,select.SelectionId,'賽果',select.SelectionName);" name="itemSelection"> <p class="winEquLose" v-bind:name="'item'+item.MarketId">{{select.SelectionName}}</p> <p class="winEquLoseOdds " v-bind:name="'item'+item.MarketId"> <span v-bind:id="item.MarketId+select.SelectionId" v-bind:maxlimit="select.MaxStakeLimit">{{select.BackOdds}}</span> <img src="img/upIng.png" style="width:0.2rem;display:none;" v-bind:id="'redOne'+item.MarketId+select.SelectionId" /> <img src="img/downIng.png" style="width:0.2rem;display:none;" v-bind:id="'greenOne'+item.MarketId+select.SelectionId" /> </p> </p> </p> <!--單雙--> <p class="diffPlaysTetx" v-for="(item,index) in eventDetail.Market" v-if="item.RuleType==130"> <span class="speciesName">單雙</span> <span class="rotary" v-if="item.State!=1">(已封盤)</span> <span class="speciesExp">猜90分鐘(含補(bǔ)時)比賽總進(jìn)球的單雙</span> </p> <p id="oddeven" v-for="(item,index) in eventDetail.Market" v-if="item.RuleType==130" name="selectionItems" class="oddeven"> <p v-bind:class="[(select.BackOdds<1.01 || item.State!=1) ? 'oddevenitemGray commonBorderGray':'oddevenitem commonBorder']" v-for="(select,index) in item.Selection" v-on:click="select.BackOdds>=1.01 &&clickFun($event,item.State,select.BackOdds,item.MarketId,select.SelectionId,'單雙',select.SelectionName)" name="itemSelection"> <p class="winEquLose" v-bind:name="'item'+item.MarketId" v-bind:id="'selectionname'+item.MarketId+select.SelectionId">{{select.SelectionName}}</p> <p class="winEquLoseOdds" v-bind:name="'item'+item.MarketId"> <span v-bind:id="item.MarketId+select.SelectionId" v-bind:maxlimit="select.MaxStakeLimit">{{select.BackOdds}}</span> <img src="img/upIng.png" style="width:0.2rem;display:none;" v-bind:id="'redOne'+item.MarketId+select.SelectionId" /> <img src="img/downIng.png" style="width:0.2rem;display:none;" v-bind:id="'greenOne'+item.MarketId+select.SelectionId" /> </p> </p> </p> <!--總進(jìn)球--> <p class="diffPlaysTetx" v-for="(item,index) in eventDetail.Market" v-if="item.RuleType==410"> <span class="speciesName">總進(jìn)球 </span> <span class="rotary" v-if="item.State!=1">(已封盤)</span> <span class="speciesExp">猜90分鐘(含補(bǔ)時)比賽總進(jìn)球的數(shù) </span> </p> <p id="totalGoals" v-for="(item,index) in eventDetail.Market" v-if="item.RuleType==410" name="selectionItems" class="totalGoals"> <p v-bind:class="[(select.BackOdds<1.01 || item.State!=1) ? 'totalGoalitemGray commonBorderGray':'totalGoalitem commonBorder']" v-for="(select,index) in item.Selection" v-on:click="select.BackOdds>=1.01 &&clickFun($event,item.State,select.BackOdds,item.MarketId,select.SelectionId,'總進(jìn)球',select.SelectionName)" name="itemSelection"> <p class="winEquLose" v-bind:name="'item'+item.MarketId" v-bind:id="'selectionname'+item.MarketId+select.SelectionId">{{select.SelectionName}}</p> <p class="winEquLoseOdds" v-bind:name="'item'+item.MarketId"> <span v-bind:id="item.MarketId+select.SelectionId" v-bind:maxlimit="select.MaxStakeLimit">{{select.BackOdds}}</span> <img src="img/upIng.png" style="width:0.2rem;display:none;" v-bind:id="'redOne'+item.MarketId+select.SelectionId" /> <img src="img/downIng.png" style="width:0.2rem;display:none;" v-bind:id="'greenOne'+item.MarketId+select.SelectionId" /> </p> </p> </p> <!--全場比分--> <p class="diffPlaysTetx" v-for="(item,index) in eventDetail.Market" v-if="item.RuleType==140"> <span class="speciesName">全場比分</span> <span class="rotary" v-if="item.State!=1">(已封盤)</span> <span class="speciesExp">猜90分鐘(含補(bǔ)時)全場比分</span> </p> <p id="correctScoreHome" v-for="(item,index) in eventDetail.Market" v-if="item.RuleType==140" name="selectionItems" class="correctScoreHomeAway"> <p v-bind:class="[(select.BackOdds<1.01 || item.State!=1) ? 'correctScoreitemGray commonBorderGray':'correctScoreitem commonBorder']" v-for="(select,index) in item.Selection" v-on:click="select.BackOdds>=1.01 &&clickFun($event,item.State,select.BackOdds,item.MarketId,select.SelectionId,'全場比分',select.SelectionName)" name="itemSelection"> <p class="winEquLose" v-bind:name="'item'+item.MarketId" v-bind:id="'selectionname'+item.MarketId+select.SelectionId">{{select.SelectionName}}</p> <p class="winEquLoseOdds" v-bind:name="'item'+item.MarketId"> <span v-bind:id="item.MarketId+select.SelectionId" v-bind:maxlimit="select.MaxStakeLimit">{{select.BackOdds}}</span> <img src="img/upIng.png" style="width:0.2rem;display:none;" v-bind:id="'redOne'+item.MarketId+select.SelectionId" /> <img src="img/downIng.png" style="width:0.2rem;display:none;" v-bind:id="'greenOne'+item.MarketId+select.SelectionId" /> </p> </p> </p> <p class="downImg" onclick="clickImg()"> <img src="img/toDown.png" /> </p> <!--下一進(jìn)球--> <p class="diffPlaysTetx" v-for="(item,index) in eventDetail.Market" v-if="item.RuleType==350"> <span class="speciesName">下一進(jìn)球</span> <span class="rotary" v-if="item.State!=1">(已封盤)</span> <span class="speciesExp">猜90分鐘(含補(bǔ)時)下一進(jìn)球的球隊(duì)</span> </p> <p id="nextgoal" v-for="(item,index) in eventDetail.Market" v-if="item.RuleType==350" name="selectionItems" class="result"> <p v-bind:class="[(select.BackOdds<1.01 || item.State!=1) ? 'resutitemGray commonBorderGray':'resutitem commonBorder']" v-for="(select,index) in item.Selection" v-on:click="select.BackOdds>=1.01 &&clickFun($event,item.State,select.BackOdds,item.MarketId,select.SelectionId,'下一進(jìn)球',select.SelectionName)" name="itemSelection"> <p class="winEquLose" v-bind:name="'item'+item.MarketId" v-bind:id="'selectionname'+item.MarketId+select.SelectionId">{{select.SelectionName}}</p> <p class="winEquLoseOdds" v-bind:name="'item'+item.MarketId"> <span v-bind:id="item.MarketId+select.SelectionId" v-bind:maxlimit="select.MaxStakeLimit">{{select.BackOdds}}</span> <img src="img/upIng.png" style="width:0.2rem;display:none;" v-bind:id="'redOne'+item.MarketId+select.SelectionId" /> <img src="img/downIng.png" style="width:0.2rem;display:none;" v-bind:id="'greenOne'+item.MarketId+select.SelectionId" /> </p> </p> <p class="" style="width: 100%;height:0.45rem;"></p> </p> <p class="perchp" style="width: 100%;height:3rem;"></p> </p> </p> <!--競猜記錄--> <p class="downChangrTab guessRecord"> <p class="hide-body" id="dialogorders"> <p class="tableNameGuess"> <li>玩法</li> <li>選項(xiàng)</li> <li>賠率</li> <li>本金</li> <li>結(jié)果</li> </p> <ul style="background:#FFFFFF;height:4.79rem;overflow: scroll;"> <p class="guessedLists" id="contentOrders" v-for="(item,index) in orders"> <li> {{item.MarketName}} </li> <li> {{item.SelectionName}} </li> <li> {{item.FillPrice}} </li> <li> {{item.FillAmount}} </li> <li> <p v-if="item.Status == '0'"> 待確認(rèn)</p> <p v-else-if="item.Status == '1'">訂單正常</p> <p v-else-if="item.Status == '2'">{{item.NetReturn}}</p> <p v-else-if="item.Status == '3'">訂單已被取消</p> <p v-else-if="item.Status == '4'">訂單無效</p> <p v-else="item.Status == '5'">訂單被拒絕,投注延遲期間發(fā)生重要事件等原因</p> </li> </p> </ul> </p> </p> <!--賽事事件--> <p class="downChangrTab" style="display: none;" v-if=""> <p class="login-body" id="contentCases"> <table class="whatHappen" v-if="cases.length >0"> <tr> <td></td> <td class="happenedMiddle"> <p class="happenedMiddle_top" style="margin-top: 0.4rem;"></p> </td> <td></td> </tr> </table> <table class="whatHappen" style="" v-for="(item,index) in cases" border="0" cellspacing="0" cellpadding="0"> <tr> <td></td> <td class="happenedMiddle"> <p class="happenedMiddle_line"></p> </td> <td></td> </tr> <tr v-if="item.CaseDescription.indexOf('主')>-1"> <td class="eventsHappendLeft_things"> <p class="eventsText"> <p class="eventsTextLeft_time">{{item.CaseMinutes}}'</p> <p class="eventsTextLeft_Country">{{item.CaseDescription}}</p> </p> </td> <td class="happenedMiddle"> <p class="eventsHappend_img"> <img :src="GetMatchEventImg(item.CaseDescription)" /> </p> </td> <td></td> </tr> <tr v-if="item.CaseDescription.indexOf('客')>-1"> <td></td> <td class="happenedMiddle"> <p class="eventsHappend_img"> <img :src="GetMatchEventImg(item.CaseDescription)" /> </p> </td> <td class="eventsHappendRight_things"> <p class="eventsText"> <p class="eventsTextRight_Country">{{item.CaseDescription}}</p> <p class="eventsTextRight_time">{{item.CaseMinutes}}'</p> </p> </td> </tr> <tr v-if="item.CaseDescription.indexOf('主')<0 && item.CaseDescription.indexOf('主')<0"> <td></td> <td> <a class="ti tlefoc">{{item.CaseMinutes}}'</a> <a class="titlefoc">{{item.DesChina}}</a> </td> <td></td> </tr> </table> <table class="whatHappen" v-if="cases.length >0"> <tr> <td></td> <td class="happenedMiddle"> <p class="happenedMiddle_line"></p> <p class="happenedMiddle_top"></p> </td> <td></td> </tr> </table> <!--<p style="width: 100%; height: 2.7rem;"></p>--> </p> </p> <!--技術(shù)統(tǒng)計--> <p class="downChangrTab" style="display: none;"> <p class="skillInfoGaryBg" id="stutsskillsData"> <p class="skillInfo" v-for="(item, index) in skillsData"> <li class="shotsOnTargets"> <p class="shotsOnTargets_left"> <p class="skillsTextFonts">{{item.AwayTeamValue}}</p> <p class="sotl_bg"> <p class="sotl_bgProgress"></p> </p> </p> <p class="shotsOnTargets_middle"> <img :src="GetMatchStatsImage(item.StatsType)" /> <p class="shills_name">{{item.StatsType}}</p> </p> <p class="shotsOnTargets_right"> <p class="skillsTextFonts">{{item.HomeTeamValue}}</p> <p class="sotl_bg"> <p class="sotl_bgProgress"></p> </p> </p> </li> </p> </p> </p> </p> <!--底部下單--> <p class="buttomOrder"> <!--金額輸入--> <!--競猜金額--> <p class="aboutMoney"> <input type="text" name="" id="betmoney" class="gussMoney" value="競猜金額" placeholder="" readonly="readonly" v-model="gussMoney" /> <img src="img/clearBetMoney.png" class="clearGussMoney" id="clearGussMoney" /> <!--余額--> <span class="balanceMoney" id="minemoney">我的余額:888</span> <!--下注金額--> <p class="diffGussMoney" style="text-align:center;"> <ul> <li name="bettingmoney" class="difGuMonCom" val="100">+100</li> <li name="bettingmoney" class="difGuMonCom" val="500">+500</li> <li name="bettingmoney" class="difGuMonCom" val="1000">+1000</li> <li class="difGuMonCom" id="allin" style="line-height: 0.5rem;"> <p style="height: 0.3rem;">All <span style="margin-left: 0.05rem;">in</span></p> <p id="allinvalue" style="height: 0.3rem;">100</p> </li> </ul> </p> <!--確定--> <p class="subSure subSureRed" style="text-align:center;" onclick="CreateOrder();" id="subSure"> 確定 </p> </p> </p> <!--下單成功后遮罩層--> <p id="overlay" class="overlay"></p> </p> <p> <img src="img/goal/goalball.png" /> <img src="img/goal/goal.png" /> <img src="img/goal/fireworks.png" /> </p> <script src="js/jquery-1.10.2.min.js" type="text/javascript" charset="utf-8"></script> <script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script> <script src="js/common.js?ver=012902" type="text/javascript" charset="utf-8"></script> <script src="js/jquery.cookie.min.js"></script> <script src="js/mask.js?ver=012901"></script> <script type="text/javascript" src="js/eventDetailsNew.js?ver=012908"></script> <script src="../js/animation.js"></script> </body> </html>
以上就是如何解決HTML5 Canvas圖像模糊的問題,小編相信有部分知識點(diǎn)可能是我們?nèi)粘9ぷ鲿姷交蛴玫降摹OM隳芡ㄟ^這篇文章學(xué)到更多知識。更多詳情敬請關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。
分享標(biāo)題:如何解決HTML5Canvas圖像模糊的問題
標(biāo)題來源:http://www.rwnh.cn/article34/jiphpe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供電子商務(wù)、網(wǎng)站改版、外貿(mào)建站、虛擬主機(jī)、網(wǎng)站設(shè)計、企業(yè)建站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)