當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Processing shape()用法及代碼示例

Processing, shape()用法介紹。

用法

  • shape(shape)
  • shape(shape, x, y)
  • shape(shape, a, b, c, d)

參數

  • shape (PShape) 要顯示的形狀
  • x (float) 形狀的 x 坐標
  • y (float) 形狀的 y 坐標
  • a (float) 形狀的 x 坐標
  • b (float) 形狀的 y 坐標
  • c (float) 顯示形狀的寬度
  • d (float) 顯示形狀的高度

返回

  • void

說明

將形狀繪製到顯示窗口。形狀必須在草圖的"data" 目錄中才能正確加載。從"Sketch" 菜單中選擇“添加文件...”以添加形狀。處理當前適用於 SVG、OBJ 和 custom-created 形狀。 shape 參數指定要顯示的形狀,坐標參數定義形狀從左上角開始的位置。除非 cd 參數指定不同的大小,否則形狀會以其原始大小顯示。 shapeMode() 函數可用於更改這些參數的解釋方式。

例子

PShape s;

void setup() {
  size(400,400);
  s = loadShape("bot.svg");
}

void draw() {
  shape(s, 40, 40, 320, 320);
}
Image output for example 1

相關用法


注:本文由純淨天空篩選整理自processing.org大神的英文原創作品 shape()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。