How can I make this code display a 3d regular pyramid ? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 3

How can I make this code display a 3d regular pyramid ?

This is a code I made trying to make a 3d pyramid but I can not think of a way to convert those rectangles into equilateral triangles. https://code.sololearn.com/WBHQc83YJyrp/?ref=app

15th Apr 2020, 12:51 PM
abcd
abcd - avatar
8 ответов
+ 3
https://code.sololearn.com/WJLRSsJL2ZyM/?ref=app
16th Apr 2020, 1:25 AM
visph
visph - avatar
+ 2
https://code.sololearn.com/WdDHKx0zZog8/?ref=app This was another solution I found experimenting yesterday. It is a bit shorter but not very intutive
16th Apr 2020, 10:05 AM
abcd
abcd - avatar
+ 2
That's cool... because it could be less or more unintuitive for a lot ;) However, once you have understood the trick, that's not very hard... even if html and css could become very verbose to describe complex combinations ;) (that's true for a lot of tricks to avoid js and use only pure Html/Css)
16th Apr 2020, 10:07 AM
visph
visph - avatar
+ 2
Yeah, your solution is a most known trick to draw triangle with html/css... (good idea anyway: I have thinking to it, but the other solution is more flexible). What I should test one day, is to try to use svg and/or canvas instead more classicals elements ;P
16th Apr 2020, 10:12 AM
visph
visph - avatar
+ 2
That's a good challenge, and could work even if js is not available (user disabled it, plain text browser, and so on...)
16th Apr 2020, 10:15 AM
visph
visph - avatar
+ 1
Thank you very much. Your program was very easy to understand.
16th Apr 2020, 9:56 AM
abcd
abcd - avatar
+ 1
You are correct visph. Js is very useful but not using it is sometimes a better approach. 😀
16th Apr 2020, 10:12 AM
abcd
abcd - avatar
0
That would surely be an interesting and challenging. 👍🏻👍🏻
16th Apr 2020, 10:18 AM
abcd
abcd - avatar