第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

rotate 命令將 rect 平移到另一個位置處理

rotate 命令將 rect 平移到另一個位置處理

交互式愛情 2022-12-29 14:03:08
我在處理過程中將矩形旋轉(zhuǎn)了 35。這是我的代碼。pushMatrix();rotate(35);stroke(74, 73, 74);fill(156, 153, 153);rect(cannon1PositionX,cannon1PositionY,25,60,50);noStroke();fill(173, 168, 173);rect(cannon1PositionX + 3,cannon1PositionY + 4,20,50,50);popMatrix();但是,如果我將旋轉(zhuǎn)更改為 40,則矩形將旋轉(zhuǎn)并平移到另一個位置。如何解決這個問題?
查看完整描述

1 回答

?
一只甜甜圈

TA貢獻1836條經(jīng)驗 獲得超5個贊

你的問題是,當你第一次使用時,rotate()你是在參考整個畫布旋轉(zhuǎn),所以當你使用時canon1PositionX,cannon1PositionY根據(jù)你當前面對畫布的角度,位置會發(fā)生變化。


您需要做的是:


pushMatrix();

// Go to the cannon position

translate(cannon1PositionX, cannon1PositionY);

// Rotate to the right angle

rotate(35);

// Draw the cannon at the current position and with the right angle

rect(0, 0, 25, 60, 50);

// Draw the second cannon next to the current one

rect(3, 4, 20, 50, 50);

popMatrix();


查看完整回答
反對 回復 2022-12-29
  • 1 回答
  • 0 關(guān)注
  • 126 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號