嘗試自訂螢幕
- 不要忘記不僅用物件(按鈕/滑桿/其他)填充正在創建的頁面,還用帶有說明的標題填充。有時也會用表格來對齊文字
- 要製作多少個標題和物件群組取決於您。我通常按目的而不是按對象的相似性進行分組
<h1>Green Screen Web Page</h1> <script src="https://www.dukelearntoprogram.com/course1/common/js/image/SimpleImage.js"> </script> <canvas> <ul> <li>If there is a standard object whose size and color suit you, I advise you not to explicitly set parameters for it. Save time</li> <li>Also, if you are not making a new project, but a continuation, you can save the selected settings and simply copy from .CSS to .CSS file </li> </ul> <pre class="brush:php;toolbar:false">h1 { font-size: 20pt; font-family: Arial; color: #4B0082; } body { background-color: #FAEBD7; } p { font-size: 13pt; } canvas { width: 380px; background-color: #7B68EE; border: 2px solid #A9A9A9; } input { font-size: 12pt; }
登入後複製
這是一個相當簡單但說明性的頁面設計:
- 最好將所有與物件相關的工作封裝在函數中,以分隔全域變數和局部變數的區域
- 用預設值(null)來辨識值-這是我聽過的最好的程式規則。錯誤-100
var fgimage = null; var bgimage = null; var can1 = null; var can2 = null; function loadForegroundImage(){ can1 = document.getElementById("can1"); var imgFile = document.getElementById("fgfile"); fgimage = new SimpleImage(imgFile); fgimage.drawTo(can1); } function loadBackgroundImage(){ can2 = document.getElementById("can2"); var imgFile = document.getElementById("bgfile"); bgimage = new SimpleImage(imgFile); bgimage.drawTo(can2); } function doGreenScreen(){ if (fgimage==null || !fgimage.complete()) { alert("Foreground not loaded"); return; } if (bgimage==null || !bgimage.complete()) { alert("Background not loaded"); return; } clearCanvas(); var output = new SimpleImage(fgimage.getWidth(), fgimage.getHeight()); for (var pixel of fgimage.values()) { if (pixel.getGreen()> pixel.getRed() + pixel.getBlue()) { var x = pixel.getX(); var y = pixel.getY(); var bgpixel = bgimage.getPixel(x, y); output.setPixel(x, y, bgpixel); } else { output.setPixel(pixel.getX(), pixel.getY(), pixel); } } output.drawTo(can1); } function clearCanvas(){ can1 = document.getElementById("can1"); can2 = document.getElementById("can2"); var context1 = can1.getContext("2d"); var context2 = can2.getContext("2d"); context1.clearRect(0,0,can1.width,can1.height); context2.clearRect(0,0,can2.width,can2.height); }
登入後複製
以上是嘗試自訂螢幕的詳細內容。更多資訊請關注PHP中文網其他相關文章!
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章
<🎜>:種植花園 - 完整的突變指南
4 週前
By DDD
<🎜>:泡泡膠模擬器無窮大 - 如何獲取和使用皇家鑰匙
4 週前
By 尊渡假赌尊渡假赌尊渡假赌
北端:融合系統,解釋
1 個月前
By 尊渡假赌尊渡假赌尊渡假赌
Mandragora:巫婆樹的耳語 - 如何解鎖抓鉤
4 週前
By 尊渡假赌尊渡假赌尊渡假赌
<🎜>掩蓋:探險33-如何獲得完美的色度催化劑
2 週前
By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

在本週的平台新聞綜述中,Chrome引入了一個用於加載的新屬性,Web開發人員的可訪問性規範以及BBC Move
