Sideway
output.to from Sideway
`-=[]โŸจโŸฉ\;',./~!@#$%^&*()_+{}|:"<>? ๐‘Ž๐‘๐‘๐‘‘๐‘’๐‘“๐‘”โ„Ž๐‘–๐‘—๐‘˜๐‘™๐‘š๐‘›๐‘œ๐‘๐‘ž๐‘Ÿ๐‘ ๐‘ก๐‘ข๐‘ฃ๐‘ค๐‘ฅ๐‘ฆ๐‘ง ร…โ€‰โˆ’โ€‚ร—โ€ƒโ‹…โˆ“ยฑโˆ˜๊žŠ๏นฆโˆ—โˆ™ โ„ฏ ๐”ธ๐”นโ„‚๐”ป๐”ผ๐”ฝ๐”พโ„๐•€๐•๐•‚๐•ƒ๐•„โ„•๐•†โ„™โ„šโ„๐•Š๐•‹๐•Œ๐•๐•Ž๐•๐•โ„ค๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ๐‘€๐‘๐‘‚๐‘ƒ๐‘„๐‘…๐‘†๐‘‡๐‘ˆ๐‘‰๐‘Š๐‘‹๐‘Œ๐‘ โˆผโˆฝโˆพโ‰โ‰‚โ‰ƒโ‰„โ‰…โ‰†โ‰‡โ‰ˆโ‰‰โ‰Œโ‰โ‰ โ‰ก โ‰คโ‰ฅโ‰ฆโ‰งโ‰จโ‰ฉโ‰ชโ‰ซ โˆˆโˆ‰โˆŠโˆ‹โˆŒโˆ โŠ‚โŠƒโŠ„โŠ…โІโЇ ๐›ผ๐›ฝ๐›พ๐›ฟ๐œ€๐œ๐œ‚๐œƒ๐œ„๐œ…๐œ†๐œ‡๐œˆ๐œ‰๐œŠ๐œ‹๐œŒ๐œŽ๐œ๐œ๐œ‘๐œ’๐œ“๐œ” โˆ€โˆ‚โˆƒโˆ…โฆฐโˆ†โˆ‡โˆŽโˆžโˆโˆดโˆต โˆโˆโˆ‘โ‹€โ‹โ‹‚โ‹ƒ โˆงโˆจโˆฉโˆช โˆซโˆฌโˆญโˆฎโˆฏโˆฐโˆฑโˆฒโˆณ โˆฅโ‹ฎโ‹ฏโ‹ฐโ‹ฑ โ€– โ€ฒ โ€ณ โ€ด โ„ โ— สน สบ โ€ต โ€ถ โ€ท ๏น ๏น‚ ๏นƒ ๏น„ ๏ธน ๏ธบ ๏ธป ๏ธผ ๏ธ— ๏ธ˜ ๏ธฟ ๏น€ ๏ธฝ ๏ธพ ๏น‡ ๏นˆ ๏ธท ๏ธธ โœ   โ   โŽด  โŽต  โž   โŸ   โ    โก โ†โ†‘โ†’โ†“โ†คโ†ฆโ†ฅโ†งโ†”โ†•โ†–โ†—โ†˜โ†™โ–ฒโ–ผโ—€โ–ถโ†บโ†ปโŸฒโŸณ โ†ผโ†ฝโ†พโ†ฟโ‡€โ‡โ‡‚โ‡ƒโ‡„โ‡…โ‡†โ‡‡ โ‡โ‡‘โ‡’โ‡“โ‡”โ‡Œโ‡โ‡โ‡•โ‡–โ‡—โ‡˜โ‡™โ‡™โ‡ณโฅขโฅฃโฅคโฅฅโฅฆโฅงโฅจโฅฉโฅชโฅซโฅฌโฅญโฅฎโฅฏ
Draft for Information Only

Content

Transformation
โ€ƒTypes of Transformation
โ€ƒTransformation Between Two Mobjects
โ€ƒโ€ƒExamples:
โ€ƒโ€ƒโ€ƒTransform, ReplacementTransform, TransformFromCopy, MoveToTarget
โ€ƒโ€ƒโ€ƒโ€ƒCode
โ€ƒโ€ƒโ€ƒโ€ƒOutput
โ€ƒTransformation of a Mobject
โ€ƒTransformation of Animation Mobjects

Transformation

Transformation is one kind of animation in Manim. 

Types of Transformation

Types of Manim transformation are:
  • Transform
    • ClockwiseTransform
    • CounterclockwiseTransform
  • ReplacementTransform
  • TransformFromCopy
  • MoveToTarget
  • CyclicReplace
    • Swap
  • ApplyMethod
    • ApplyPointwiseFunction
      • ApplyPointwiseFunctionToCenter
      • ApplyMatrix
    • FadeToColor
    • ScaleInPlace
      • ShrinkToCenter
    • Restore
    • ApplyComplexFunction
    • specialized.MoveCar
  • ApplyFunction
  • TransformAnimations

Transformation Between Two Mobjects

Manim function to transform from one Mobject to another Mobject or vice versa. Both ClockwiseTransform and CounterclockwiseTransform transformations are used to specify argment of path_arc parameter.
  mobject target_mobject path_arc path_arc_axis path_func replace_mobject_with_target_in_scene
Transform   None 0 OUT None False
ReplacementTransform           True
TransformFromCopy target_mobject mobject        
ClockwiseTransform     -np.pi      
CounterclockwiseTransform     np.pi      
MoveToTarget   target_mobject        

Examples:

Transform, ReplacementTransform, TransformFromCopy, MoveToTarget

Code
# folder/file: tut/manim_animation_mobjectstransformation_001a.py

from manimlib.scene.scene import Scene
from manimlib.mobject.mobject import Group
from manimlib.mobject.geometry import Dot, Circle, Square
from manimlib.animation.creation import ShowCreation
from manimlib.animation.transform import Transform, ReplacementTransform, TransformFromCopy, MoveToTarget, ApplyMethod
from manimlib.mobject.svg.tex_mobject import TextMobject, TexMobject
from manimlib.animation.composition import AnimationGroup

class manim_animation_mobjectstransformation_001a(Scene): 
   def construct(self):
      rows,cols=(9,5)
      x0=[-4,*[2*i for i in range(cols-1)]]
      y0=[3.5,*[2.5-0.8*i for i in range(rows-1)]]
      txtx=["","loc 1","loc 2","m1 val","m2 val"]
      for i in range(cols): self.add(TextMobject(txtx[i]).move_to(([x0[i],y0[0],0])))
      xt=TextMobject(r"$\rightarrow$").move_to(([(x0[1]+x0[2])/2,y0[0],0]))
      txty=["","Transform","","ReplacementTransform","","TransformFromCopy","","MoveToTarget",""]
      for i in range(rows): self.add(TextMobject(txty[i]).move_to(([x0[0],y0[i],0])))
      self.add(xt)
      [[self.add(Dot().move_to(([x0[i],y0[j],0]))) for i in range(1,3)] for j in range(1,rows)] 
      d=Dot().set_width(0.0000001);a1=[d];a2=[d];a3=[d];a4=[d]
      for j in range(1,rows):
            a1.append(Circle().scale(0.2).move_to([x0[1],y0[j],0]))
            a2.append(Square().scale(0.2).move_to([x0[2],y0[j],0]))
            a3.append(a1[j].copy().move_to([x0[3],y0[j],0]).add_updater(lambda mob,obj=a1[j],x=x0[3],y=y0[j]:mob.become(obj.copy().move_to([x,y,0]))))
            a4.append(a2[j].copy().move_to([x0[4],y0[j],0]).add_updater(lambda mob,obj=a2[j],x=x0[4],y=y0[j]:mob.become(obj.copy().move_to([x,y,0]))))
      self.add(*a1[1::2],*a2[1::2])
      self.add(*a3,*a4)         
      a1[7].target=a2[7]
      a1[8].target=a2[8]
      for obj in a1[1:]:
         self.add(Square(stroke_width=2,color="#FFFF00").add_updater(lambda mob,obj=obj:mob.surround(obj,stretch=True,buff=0.2)))
      for obj in a2[1:]:
         self.add(Square(stroke_width=2,color="#DC75CD").add_updater(lambda mob,obj=obj:mob.surround(obj,stretch=True,buff=0.3)))
      self.wait(2)
      self.play(AnimationGroup(\
         Transform(a1[1],a2[1]),\
         Transform(a1[2],a2[2]),\
         ReplacementTransform(a1[3],a2[3]),\
         ReplacementTransform(a1[4],a2[4]),\
         TransformFromCopy(a1[5],a2[5]),\
         TransformFromCopy(a1[6],a2[6]),\
         MoveToTarget(a1[7]),\
         MoveToTarget(a1[8])\
            ),run_time=5)
      self.wait(3)
      Group(*a1).shift([0.3,0,0]).set_color("#11FF00")
      self.wait(3)
      self.play(ApplyMethod(Group(*a1).shift,([0.3,0,0])),run_time=3)
      self.wait(10)
Output
image

Transformation of a Mobject

Manim function to transform a Mobject.
  mobject target_mobject path_arc path_arc_axis path_func replace_mobject_with_target_in_scene
Transform   None 0 OUT None False
ApplyMethod            
ApplyPointwiseFunction            
ApplyPointwiseFunctionToCenter            
FadeToColor            
ScaleInPlace            
ShrinkToCenter            
Restore            
ApplyFunction            
ApplyMatrix            
ApplyComplexFunction            

Transformation of Animation Mobjects

  mobject target_mobject path_arc path_arc_axis path_func replace_mobject_with_target_in_scene
Transform   None 0 OUT None False
CyclicReplace *mobjects
(target[-1],*target[:-1])
(self.group) 90*DEGREES      
Swap *mobjects
(target[-1],*target[:-1])
(self.group) 90*DEGREES      
TransformAnimations start_anim
(start_anim.mobject)
end_anim
(end_anim.mobject)
       

ยฉsideway

ID: 200500502 Last Updated: 5/17/2020 Revision: 1


Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 9

Culture

Chinese 1097

English 339

Travel 38

Reference 79

Hardware 55

Computer

Hardware 259

Software

Application 213

Digitization 37

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 290new

Unicode 504

HTML 66new

Common Color 1new

Html Entity (Unicode) 1new

Html 401 Special 1

CSS 65new

Selector 1

SVG 46

ASP.NET 270

OS 447new

MS Windows

Windows10 1new

.NET Framework 1

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Set 1

Logic 1

Algebra 84

Number Theory 207new

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2026 Sideway . All rights reserved Disclaimers last modified on 06 September 2019