We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, im very new to programming and i'm trying to leave a trail on these ellipses that i have. I've watched a few videos but i can't seem to get it down.
Answers
Pictures of code are unreadable and useless for testing. Paste the actual code.
oops sorry.
Got it. I'm assuming that you have already watched the Coding Train video on p5.js trails:
Did you check out the pMouseX reference demo sketch?
Did you try the drawing example?
...more:
https://www.google.com/search?q=p5.js+trail
Yep i tried watching it.. but i seriously dont get it. Like the push function (this.history.push) . I thought that had to be used with pop
push()
/pop()
are functions for Processing settings.history.push()
is different -- it is a method of thehistory
object;particles.push()
is a method of theparticles
object,paths.push()
et cetera -- in these cases those objects are arrays; when you push onto an array you add something to the end of it and you aren't required to pop after.I tried again. this is what i came up with. Nothing really changed LOL :( can you show me where i went wrong? i really appreciate the help
Notice you have two push and only one pop.
Ok, now we need to work in your problem... or the wording of it. You post is about leaving a trail. However, your post contains some wave function which makes me thing this is not a tail challenge, or is a tail challenge plus something else that you haven't described. So you need to provide more details. You said:
What does your code suppose to do and what is your code doing right now?
One thing you need to remember is that the canvas is updated at the end of draw, after executing both for loops. I am not totally sure if you really need two for loops. The first loop is of size 2000 while the second one grows as fast as you add elements from the first loop. This is unnecessary as the wavePhase value gets updated only at the end of draw. In other words, you should revise your code and remove your second loop, line 25.
Kf
My code works fine. Im trying to add something on, but this thing that im adding on isnt working. Im trying to add a trail the points that make up the wave. Line 25 is meant to be for the trail. I watched the coding trains video on object trails and tried replicating it onto my own code, which is my previous comment, however the code ran as it did before... without a trail.
Parameters for you to adjust:
1. Length of the trail
2. refLength defines the distribution of the dots in space
3. Phase defines the distance between dots of the same trail
4. Number of dots. NOTE: More dots => super slow
Kf
@oydis I forgot to mentioned in my last post you should avoid using
history
as that is a reserve variable in some browsers. I was using firefox and the history content from your prev code was being overwritten by the browser, hence the change of name tohistoryy
.Kf
Thank you so much!