Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+9 votes

When I open in on VLC it is only a split second video, even though I let the animation play for a while. Does anyone know what I am doing wrong? Here is my code.

extensions [vid]
breed [planet planets]
breed [star stars]

to background
   vid:record-view

  ;Q1
  cro 25 [
    set color 47 + random 3
    set shape "star"
    set size random-float 1 setxyz random -16 random 16 random 16]
  ;Q2
  cro 25 [
  set color 47 + random 3
    set shape "star"
    set size random-float 1 setxyz random -16 random -16 random 16]
  ;Q3
  cro 25 [
   set color 47 + random 3
    set shape "star"
    set size random-float 1 setxyz random -16 random -16 random -16]
  ;Q4
  cro 25 [
  set color 47 + random 3
    set shape "star"
    set size random-float 1 setxyz random 16 random -16 random -16]
  ;Q5
  cro 25 [
  set color 47 + random 3
    set shape "star"
    set size random-float 1 setxyz random 16 random 16 random -16]
  ;Q6
  cro 25 [
   set color 47 + random 3
    set shape "star"
    set size random-float 1 setxyz random 16 random 16 random 16]
  ;Q7
  cro 25 [
set color 47 + random 3
    set shape "star"
    set size random-float 1 setxyz random -16 random 16 random -16]
  ;Q8
  cro 25 [
  set color 47 + random 3
    set shape "star"
    set size random-float 1 setxyz random 16 random -16 random 16]
end


to sun
vid:start-recorder
  clear-all
  CRO 1
  ask turtles  [ setxyz 0 0 0
    set size 6
    set color [225 201 34 ]
    ;make sun
    set shape "circle"
    stamp



  ]


end

to earth
  
  create-planet 1
  ask planet [ setxyz 8 5 0
    set size 3
    set color [0 100 200 ]
    pen-down  ; make earth
    set shape "circle"
  ]

end

to orbit

  ask planet [
    pen-up
    repeat 360 [forward .15 right 1]
  ]
end

to finish-video
  vid:save-recording user-new-file
end
asked in CSC 150 January201920 by (1 point)
edited by

1 Answer

+6 votes

Remember, it only takes a snapshot to add to your video whenever the vid:record-view command is run. (Similar to each time you clicked the remote to take a photo during Claymation.)

You probably need to include vid:record-view a lot more places in your code. (For instance, inside the ORBIT procedure, but even more specifically, you'll need it inside the REPEAT 360 [ ... ] within the ORBIT procedure, since you probably want to see each movement in your video.

answered by (5.7k points)
+4

Okay, thank you for the help!

+4

I did what you told, but It only makes a video of setting the background and not the orbit. Do you know where I went wrong? Thanks!

Here is my new code:

extensions [vid]
breed [planet planets]
breed [star stars]

to background
  vid:record-view


  ;Q1
   vid:record-view
  cro 25 [
    set color 47 + random 3
    set shape "star"
    set size random-float 1 setxyz random -16 random 16 random 16]
  ;Q2
   vid:record-view
  cro 25 [
  set color 47 + random 3
    set shape "star"
    set size random-float 1 setxyz random -16 random -16 random 16]
  ;Q3
   vid:record-view
  cro 25 [
   set color 47 + random 3
    set shape "star"
    set size random-float 1 setxyz random -16 random -16 random -16]
  ;Q4
   vid:record-view
  cro 25 [
  set color 47 + random 3
    set shape "star"
    set size random-float 1 setxyz random 16 random -16 random -16]
  ;Q5
   vid:record-view
  cro 25 [
  set color 47 + random 3
    set shape "star"
    set size random-float 1 setxyz random 16 random 16 random -16]
  ;Q6
   vid:record-view
  cro 25 [
   set color 47 + random 3
    set shape "star"
    set size random-float 1 setxyz random 16 random 16 random 16]
  ;Q7
   vid:record-view
  cro 25 [
set color 47 + random 3
    set shape "star"
    set size random-float 1 setxyz random -16 random 16 random -16]
  ;Q8
   vid:record-view
  cro 25 [
  set color 47 + random 3
    set shape "star"
    set size random-float 1 setxyz random 16 random -16 random 16]
end


to sun
 vid:start-recorder
  CRO 1
  ask turtles  [ setxyz 0 0 0
    set size 6
    set color [225 201 34 ]
    ;make sun
    set shape "circle"
     vid:record-view
    stamp



  ]


end

to earth

vid:record-view
  create-planet 1
  ask planet [ setxyz 8 6 0
    set size 3
    set color [0 100 200 ]
    pen-down  ; make earth
    set shape "circle"
     vid:record-view
  ]

end

to orbit
vid:record-view
  ask planet [vid:record-view
    pen-up
   vid:record-view
vid:record-view
    vid:record-view repeat 360 [forward .2 right 1] vid:record-view vid:record-view
  ]
  vid:record-view
end

to finish-video
  vid:save-recording user-new-file
end
+5

Sorry if I wasn't clearer earlier -- you need to put vid:record-view INSIDE of the repeat block. That is:

repeat 360 [ forward 0.2 right 1 vid:record-view ]

(Right now you're only recording the view BEFORE and AFTER the planet has finished moving 360 times.)

...