1
- from pyodide .ffi import to_js
1
+ from pyscript .ffi import to_js
2
+ from pyscript .js_modules import THREE
2
3
from pyscript import when , window , document
3
- from js import Math , THREE , performance , Object
4
+ from js import Math , performance
4
5
import asyncio
5
6
6
7
mouse = THREE .Vector2 .new ()
@@ -42,11 +43,9 @@ def mathRandom(num = 1):
42
43
particularGroup = THREE .Object3D .new ()
43
44
modularGroup = THREE .Object3D .new ()
44
45
45
- perms = {"flatShading" :True , "color" :"#111111" , "transparent" :False , "opacity" :1 , "wireframe" :False }
46
- perms = Object .fromEntries (to_js (perms ))
46
+ perms = to_js ({"flatShading" :True , "color" :"#111111" , "transparent" :False , "opacity" :1 , "wireframe" :False })
47
47
48
- particle_perms = {"color" :"#FFFFFF" , "side" :THREE .DoubleSide }
49
- particle_perms = Object .fromEntries (to_js (particle_perms ))
48
+ particle_perms = to_js ({"color" :"#FFFFFF" , "side" :THREE .DoubleSide })
50
49
51
50
def create_cubes (mathRandom , modularGroup ):
52
51
i = 0
@@ -108,11 +107,12 @@ def generateParticle(mathRandom, particularGroup, num, amp = 2):
108
107
lightBack .position .set (0 , - 3 , - 1 )
109
108
110
109
scene .add (sceneGroup )
111
- scene .add (light )
112
- scene .add (lightBack )
110
+ #scene.add(light)
111
+ #scene.add(lightBack)
112
+ #scene.add(ambientLight)
113
113
114
- rectSize = 2
115
- intensity = 14
114
+ rectSize = 3
115
+ intensity = 44
116
116
rectLight = THREE .RectAreaLight .new ( 0x0FFFFF , intensity , rectSize , rectSize )
117
117
rectLight .position .set ( 0 , 0 , 1 )
118
118
rectLight .lookAt ( 0 , 0 , 0 )
@@ -155,4 +155,4 @@ async def main():
155
155
renderer .render ( scene , camera )
156
156
await asyncio .sleep (0.02 )
157
157
158
- asyncio . ensure_future ( main () )
158
+ main ()
0 commit comments