p5.js中的getURL()函數用於返回當前URL。
用法:
getURL()
參數:該函數不接受任何參數。
返回值:它返回當前的URL字符串。
以下示例程序旨在說明p5.js中的getURL()函數:
例:
// Declare a URL variable
let url;
// Function to set the height and
// width of window
function setup() {
createCanvas(350, 200);
// Use getURL() function to
// get the current URL
url = getURL();
}
function draw() {
// Set the background color
background(0, 200, 0);
// Set the font-size
textSize(30);
// Set the text alignment
textAlign(LEFT);
text(url, 100, height / 2);
}
輸出:
參考: https://p5js.org/reference/#/p5/getURL
相關用法
- p5.js tan()用法及代碼示例
- d3.js d3.hsl()用法及代碼示例
- d3.js d3.map.set()用法及代碼示例
- p5.js sin()用法及代碼示例
- PHP pos()用法及代碼示例
- p5.js cos()用法及代碼示例
- PHP key()用法及代碼示例
- p5.js log()用法及代碼示例
- PHP each()用法及代碼示例
- p5.js second()用法及代碼示例
- p5.js day()用法及代碼示例
- PHP Ds\Map put()用法及代碼示例
注:本文由純淨天空篩選整理自sarthak_ishu11大神的英文原創作品 p5.js | getURL() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。