LoginSignup
1
0

More than 3 years have passed since last update.

P5.js 日本語リファレンス(hex)

Last updated at Posted at 2020-08-23

このページでは「P5.js 日本語リファレンス」 の hex 関数を説明します。

hex()

説明文

数値を同等の16進表記の文字列に変換します。 2番目のパラメタ digits は、変換する16進表記の文字列の文字数を設定します。配列が渡されると、同じ長さの16進表記の文字列の配列が返されます。

構文

hex(n, [digits])

hex(ns, [digits])

パラメタ

  • n
    Number:変換する値

  • digits
    Number:変換する16進表記の文字列の文字数(オプション)

  • ns
    Number[]:変換する値の配列

戻り値

String:値の16進数の文字列表現

例1

print(hex(255)); // "000000FF"
print(hex(255, 6)); // "0000FF"
print(hex([0, 127, 255], 6)); // ["000000",  "00007F",  "0000FF"]
print(Infinity); // "FFFFFFFF"
print(-Infinity); // "00000000"

著作権

p5.js was created by Lauren McCarthy and is developed by a community of collaborators, with support from the Processing Foundation and NYU ITP. Identity and graphic design by Jerel Johnson.

ライセンス

Creative Commons(CC BY-NC-SA 4.0) に従います。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0