[VPython] Animations
Animations Moving Graphs에서 볼 수 있듯이, Animations의 핵심은 일정 시간 동안 동작을 수행할 수 있는 rate(#)이다. animation이 무한 재생되도록 하려면 (while True:) loop를 사용하고, (for i in range(#):) loop는 finite 시간 동안 재생한다. 참고 : 프로그램이 고장나면 loop에 rate(#)가 있는지 확인. Bouncing Ball Example # make sphere and 2 wall objects my_sphere = sphere(pos=vector(0,0,0), radius=0.25, color=color.green ) wall1 = box(pos=vector(2,0,0), size=vector(0.1,1,1),..
2022. 1. 18.
[VPython] Graphs (1)
Graphs graph 옵션에는 2 가지가 있다. (default is fast=True) 1. fast=False : 이동 및 확대 / 축소와 같은 interactive 기능이 있는 Plotly를 기반으로 한다. 2. fast=True : Flot을 기반으로 하며 interactive 형이 아니다. 먼저 그래프 창을 정의하고 그래프 크기, 제목 및 label을 지정한다. g = graph (width=600,height=400,title=’title here’,xtitle=’x’,ytitle=’y’, foreground=color.black, background=color.white, # optional xmin=0, xmax=10, ymin=-15, ymax=15,fast=False) # option..
2022. 1. 17.