What does this code look like on android? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

What does this code look like on android?

On my ipad particles fall on green water, where they slow down or even bounce. On the iphone, I see no water or deceleration. What does it do on android? I would be grateful for feedback as I cannot see it. On the pc i cannot tap. How can I make it look the same everywhere? https://code.sololearn.com/WLckKJThtQ2V/?ref=app

7th Jul 2020, 6:57 PM
bell
bell - avatar
20 Answers
+ 7
Feedback on android, Deceleration on water good ✅ Weight simulation good (Big particle goes first) ✅ Particle bounce at bottom ✅ Particle left the trace behind ✅ I think its perfect in android sir!, I wish I could be pro as you, I'm a new starter and I wanna be a good Front End Developer 😁
7th Jul 2020, 7:30 PM
Bagus Arif Wicaksono
Bagus Arif Wicaksono - avatar
+ 3
Its stay forever on the screen sir, I provide you with the screenshot from my phone, here: https://www.sololearn.com/post/459885/?ref=app
7th Jul 2020, 7:47 PM
Bagus Arif Wicaksono
Bagus Arif Wicaksono - avatar
+ 3
Mirielle [INACTIVE] the particles should not fall straight because there is random wind. (Fast small ones should bounce against the water). Could the angle be explained by the wind? I will check my normalisation, as wrong water resistance in the x component could cause this. The coefficient to avoid division by zero might be inappropriate. Thanks for the feedback! (Would you know why the water is not green nor viscous on the iphone?)
7th Jul 2020, 8:17 PM
bell
bell - avatar
+ 3
Mirielle [INACTIVE] Your version looks right on my phone too! So you put al the JS inside an onload {} . Is that always the right practice? Or was having two addEventListeners on the window? or was the window the wrong element to hang them to? I tried many things to get the screentouch to trigger instantiation before anything worked. This has been really useful feedback, thank you!
7th Jul 2020, 9:14 PM
bell
bell - avatar
+ 3
And the water / sky ratio makes sense now: before the area was too small for the number 0.65
7th Jul 2020, 9:17 PM
bell
bell - avatar
+ 3
Bagus Arif Wicaksono I think you’re right. I use it on an android phone, a laptop, and 2 iPads and I think it’s all good.
8th Jul 2020, 9:59 AM
ManUnitedMVM
ManUnitedMVM - avatar
+ 2
Bagus Arif Wicaksono Thank you so much, this is very helpful, gravity should act equally on all particles (after Galileo's experiment) but there is a randomly directed wind, which may lift more light particles when it goes upwards. Do the traces fade and disappear (as in ipad) or stay forever as on iphone (I wish I knew how ro make them go)?
7th Jul 2020, 7:38 PM
bell
bell - avatar
+ 1
Code Crasher , Mirielle [INACTIVE] Thank you both. To make it work on a browser I should couple generation of particles to some other event, I only just found out how to use touch (so happy!). I commented my call to the wind-force method on line 127 and now particles plunge dead, no angle. It may be the residual direction with divisor approaching zero, but a slight angle is more alive. I will definitely look into brownian motion: I have some random acceleration in the code, to make slow particles look a bit hesitant (aim is to start from physics but make particles look alive) but it is turned off in this code. Thank you for input about how to stop particles from going offscreen (trying it now), I have a strange effect I did not understand. I reset acceleration to zero adter each update so I thought I had solved it. When two particles collide, only one survives, can it be this?
7th Jul 2020, 8:47 PM
bell
bell - avatar
+ 1
Mirielle [INACTIVE] thanks for the picture! Would that not be the right physics? Particles hit the water with an angle from the windf, friction depends on squared velocity, which is much higher along gravity y than tiny wind x. Thus, the angle should increase? If the magnitude is wrong, I must have been too coarse fudging the normalisation to avoid zero division.
7th Jul 2020, 8:54 PM
bell
bell - avatar
+ 1
Code Crasher thank you! It really is fun to pull at the strings. You should have a look at the book of Daniel Shiffman I got the ideas from: The Nature of code, it is free and easy to follow because one can choose ar every point how much complexity to include. Besides, maths and physics are kept really simple.
7th Jul 2020, 9:25 PM
bell
bell - avatar
+ 1
ManUnitedMVM thank you, it is good now thanks to all the feedback and help in this thread to make the code cross platform. Thank you also for your valuable confirmation.
8th Jul 2020, 11:31 AM
bell
bell - avatar
+ 1
Little tip: If you have a computer, you can install an Android emulator and test it for yourself. Anyway to answer your question, everything looks good to me.
8th Jul 2020, 9:05 PM
ReimarPB
ReimarPB - avatar
+ 1
ReimarPB Thank you for checking! How can I run it on my computer when the code is started by touching the screen? Is the access from mouse equivalent to the touch?
8th Jul 2020, 9:11 PM
bell
bell - avatar
+ 1
bell Yes, on Android emulators you can click the mouse and it will touch the screen there. You can also swipe by dragging your mouse.
8th Jul 2020, 9:13 PM
ReimarPB
ReimarPB - avatar
+ 1
It's extremely beautiful on Android When tapped a ball of random colors appears and disappears gradually when at the bottom. The ball ie water ball leaves traces of water colours I love your program it's of fun!!! Happy coding😘
9th Jul 2020, 9:01 AM
💖Mosunmola💖🥂🥂
💖Mosunmola💖🥂🥂 - avatar
+ 1
Very creative
9th Jul 2020, 2:56 PM
7hemo Sam
+ 1
By the way, I have noticed that you are using ES6. Some older Android devices do not support that and on them, there will only be a white screen. Nothing you should worry too much about though.
9th Jul 2020, 3:09 PM
ReimarPB
ReimarPB - avatar
0
Mosunmola Alagbada thank you! it looks well on every platform now thanks to feedback and help!
9th Jul 2020, 9:32 AM
bell
bell - avatar
0
ReimarPB thank you! I will check out how old that would be.
9th Jul 2020, 4:00 PM
bell
bell - avatar
0
How to prepare for make a android developer please suggest me
9th Jul 2020, 5:49 PM
Srishti Singh