LoginSignup
0
0

More than 3 years have passed since last update.

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

Last updated at Posted at 2020-08-04

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

resetMatrix()

説明文

現在の行列を単位行列に置き換えます。

構文

resetMatrix()

例1

function setup() {
  createCanvas(200, 200);
  angleMode(DEGREES);
  rectMode(CENTER);
}

function draw() {
  background(220);

  translate(60, 60);

  // 45°回転
  let angle = 45
  applyMatrix( cos(angle), sin(angle),
              -sin(angle), cos(angle),
                        0,         0);
  stroke("red");
  rect(0, 0, 40, 40);

  //applyMatrix() をリセットします。(translate()もリセットします)
  resetMatrix();

  translate(20, 20);

  stroke("blue");
  rect(0, 0, 40, 40);
}

実行結果

著作権

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) に従います。

0
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
0
0