setMag()

ベクトルの大きさを指定された値に設定します。

setMag()の静的バージョン、例えばp5.Vector.setMag(v, 10)は、 新しいp5.Vectorオブジェクトを返し、 元のオブジェクトは変更しません。

実例

シンタックス

setMag(len)
setMag(v, len, [target])

パラメーター

len
Number:

このベクトルの新しい長さ。

v
p5.Vector:

大きさを設定するベクトル

target
p5.Vector:

結果を受け取るベクトル(オプション)

This page is generated from the comments in src/math/p5.Vector.js . Please feel free to edit it and submit a pull request!

関連するリファレンス