[Scilab-users] Replacement of pixmap by drawlater / drawnow in Version 5.4.0

Serge Steer Serge.Steer at inria.fr
Wed Dec 5 15:20:13 CET 2012


Le 04/12/2012 17:28, Jens Simon Strom a écrit :
> In version 5.3 I have written a script which produces an animated plot of a
> magnetic field showing approx. 70 oscillating and rotating arrows. The arrows
> are generated by the command 'arrows' in a loop. I used the 'pixmap' and the
> 'show_pixmap()' command resulting in a perfect calm and smooth movie.
>
> Version 5.4.0 tells me that 'pixmap' is obsolete and 'drawlater' and 'drawnow'
> shall be used instead. I have tried my best with the latter two plus 'xpause'
> but never got a satisfying result - the animation performs like a defect silent
> film projector. Deleting seem to be an issue.
>
> Could anyone kindly  give me a hint how I can calm down the animation with
> 'drawlater' and 'drawnow' in a loop where arrows are drawn with 'arrows'?
>
> 'comet' might be a workarond but that would mean a new start from scratch.
>
> Kind regards
> Jens
>
>     
>
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
does the sample code below solves the problem? Note that it does not use 
neither pixmap neither drawlater drawnow

clf();a=gca();a.data_bounds=[-1 -1;1 1]*10;
t=linspace(0,2*%pi,70);
n=110;
r1=linspace(0,1,n);
r2=linspace(1,10,n);
phi=linspace(0,%pi/2,n);

k=1;
nx=[r1(k)*cos(t+phi(k));r2(k)*cos(t+phi(k))];
ny=[r1(k)*sin(t+phi(k));r2(k)*sin(t+phi(k))];


xarrows(nx,ny)// create the Segs entity
e=gce(); //get the handle on it
realtimeinit(0.05);
for k=2:n
  realtime(k-1) //wait a little to slow down the loop if necessary
  nx=[r1(k)*cos(t+phi(k));r2(k)*cos(t+phi(k))];
  ny=[r1(k)*sin(t+phi(k));r2(k)*sin(t+phi(k))];

  e.data=[nx(:) ny(:)];//update arrow coordinates
end

Serge Steer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20121205/48839469/attachment.htm>


More information about the users mailing list