五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

〔manim教程〕第一講 物體的位置與坐標(biāo)變換 代碼展示

2023-06-16 17:10 作者:NUMT片段  | 我要投稿

?
00:30
?

FRAME_HEIGHT=8
FRAME_WIDTH≈14
RIGHT=np.array([1, 0, 0])
UP=np.array([0, 1, 0])
LEFT=np.array([-1, 0, 0])
DOWN=np.array([0, -1, 0])
IN=np.array([0, 0, -1])
OUT=np.array([0, 0, 1])

?
02:06
?

使用shift方法可以根據(jù)傳入的vector移動物體

self.add(mob)
mob.shift(LEFT*5)
mob.shift(UP*2+RIGHT*3)
mob.shift(DOWN*2, RIGHT*2) #先相加后平移

還可以使用move_to方法來使物體移動到目標(biāo)位置

move_to(point_or_mobject,aligned_edge=ORIGIN,coor_mask=np.array([1, 1, 1]))
self.add(logo)
logo.move_to(LEFT*5+UP*2)
logo.move_to(LEFT*3,aligned_edge=LEFT)
logo.move_to(LEFT*3,aligned_edge=RIGHT)
logo.move_to(UP*2,color_mask=np.array([1, 0, 1]))

?
04:05
?

使用scale可以對物件進(jìn)行縮放

self.play(FadeIn(mob))
mob.scale(2)
mob.scale(0.5)
mob.scale(1.5,about_edge=UP)
mob.scale(0.3,about_edge=RIGHT)
mob.scale(2,about_point=np.array([-2,-2,0]))
self.play(mob.scale,1.5)
self.play(mob.scale,{'scale_factor':0.6,'about_edge':LEFT})

?
05:07
?

旋轉(zhuǎn)

self.add(mob)
mob.shift(LEFT*2)
mob.rotate(90*DEGREES,axis=OUT)
mob.rotate(180*DEGREES,axis=OUT)
mob.rotate(270*DEGREES,axis=OUT)
mob.rotate(360*DEGREES,axis=OUT)
mob.rotate(90*DEGREES,axis=IN)
mob.rotate(180*DEGREES,axis=IN)
mob.rotate(270*DEGREES,axis=IN)
mob.rotate(360*DEGREES,axis=IN)

?
05:59
?

mob.rotate(angle,axis=OUT,np.array([1,0,0]))
mob.rotate(angle,axis=IN,np.array([1,0,0]))
mob.rotate_about_origin(angle,axis=OUT)

?
07:09
?

self.add(mob)
mob.shift(LEFT*2)
mob.rotate(90*DEGREES,axis=OUT)
mob.rotate(90*DEGREES,axis=IN)
mob.rotate(90*DEGREES,axis=OUT,about_point=ORIGIN)
mob.rotate(90*DEGREES,axis=IN,about_point=ORIGIN)

?
07:20
?
翻轉(zhuǎn)

self.add(mob)
mob.flip()
mob.flip(axis=RIGHT) #對稱軸方向方向
mob.flip(axis=RIGHT,about_point=ORIGIN) #對稱軸過原點
mob.flip(axis=UR,about_point=LEFT*2.5) 

?
09:06
?

self.play(FadeIn(mob))
mob.stretch(factor=2, dim=0)
mob.stretch(factor=2, dim=1)
mob.stretch(factor=3, dim=2)
mob.stretch(factor=2, dim=1,about_point=np.array([-3,-3,0]))
mob.stretch(factor=0.5, dim=1,about_point=LEFT_SIDE+TOP)
mob.stretch(factor=2, dim=1,about_edge=UP)
mob.stretch(factor=0.5, dim=1,about_edge=DOWN)
# 同樣的,所有mob的變換均為瞬間完成
# 但為了演示變換過程,
# 視頻中執(zhí)行的是將變換放入
# self.play()后對應(yīng)的動畫過程
self.play(mur.stretch, {"factor": 2, "dim": 0})

?
10:21
?

mob.to_corner(UL,buff=0)
for i in range(1,7):
    mob[i].to_corner(UL,buff=i*0.5)

所有對mob的移動操作 需要self.add(mob)才可以呈現(xiàn)

buff默認(rèn)0.5

mob.to_edge(UP,buff=0)

?
11:30
?
對齊

self.add(mob)
self.add(logo)
mob.align_to(logo)#無作用
mob.align_to(logo,RIGHT)#右側(cè)對齊
mob.align_to(logo,UR)#右上角對齊

?
12:32
?

c=Circle(radius=0.5)
sq = Square(side_length=0.5)
c.next_to(sq)
c.next_to(sq,RIGHT)
c.next_to(sq,RIGHT,aligned_edge=UP)

對齊Vgroup

A=VGroup(...)
B=VGroup(...)
B.next_to(A[2],DOWN,submoject_to_slign=B[1],aligned_edge=LEFT)
#等價于
B.next_to(A,DOWN,index_of_submobject_to_align=B[1],aligned_edge=LEFT)

?
15:04
?

這是一個mur貓 下面我們將用set_height和set_width方法調(diào)教它

?
15:04
?

img.set_height(height = 5)
img.set_height(height = 3)
img.set_height(height = 1)
img.set_width(width = 5)
img.set_width(width = 3)
img.set_width(width = 1)

按名字來說set_height是設(shè)置寬,set_width是設(shè)置長,效果不是應(yīng)當(dāng)不一樣嗎???

set_width和set_height方法在沒有使用stretch參數(shù)的情況下和使用scale方法效果一致

加入stretch參數(shù)后可以對應(yīng)的拉伸該對象

img.set_height(
?????? height = 5,
?????? stretch = True
??? )
img.set_width(
?????? width = 5,
?????? stretch = True
??? )

〔manim教程〕第一講 物體的位置與坐標(biāo)變換 代碼展示的評論 (共 條)

分享到微博請遵守國家法律
玛多县| 襄樊市| 丰宁| 三原县| 连城县| 万全县| 思南县| 隆尧县| 衢州市| 石渠县| 泾阳县| 聊城市| 莲花县| 繁峙县| 嫩江县| 西峡县| 沾化县| 嘉定区| 乌什县| 芦山县| 天镇县| 崇左市| 娄烦县| 达州市| 垣曲县| 抚松县| 区。| 绍兴县| 凤山市| 霍山县| 马尔康县| 福建省| 和平县| 开化县| 西华县| 运城市| 镶黄旗| 界首市| 凤阳县| 商都县| 会昌县|