Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %the path.
- %Setup path
- s=0:.01:1;
- X=6*s.^2-5*s.^3;
- Y=6*s-12*s.^2+6*s.^3;
- plot(X,Y)
- hold all
- %Setup drawing
- set(gca,'XLim',[-0.2 1.5],'YLim',[-0.2 1.5], 'Drawmode', 'fast', 'visible', 'on');
- axis square
- ball=line('color','r','Marker','o','MarkerSize',10,'LineWidth',2,'erase','xor','xdata',[],'ydata',[]);
- ball2=line('color','b','Marker','o','MarkerSize',10,'LineWidth',2,'erase','xor','xdata',[],'ydata',[]);
- %Original Parameter
- t=.00:.05:20;
- t2 = zeros(20,1);
- %Constant Speed
- for i=0:20
- t2(i+1)=newtarclen(i*.05,.001);
- end
- a=6*t.^2-5*t.^3;
- b=6*t-12*t.^2+6*t.^3;
- c=6*t2.^2-5*t2.^3;
- d=6*t2-12*t2.^2+6*t2.^3;
- for i = 1:21
- set(ball,'xdata',a(i),'ydata',b(i));
- set(ball2,'xdata',c(i),'ydata',d(i));
- drawnow;
- pause(0.01);
- frame = getframe(1);
- im = frame2im(frame);
- [imind,cm] = rgb2ind(im,256);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement