1- from pyodide .ffi import to_js
1+ from pyscript .ffi import to_js
2+ from pyscript .js_modules import THREE
23from pyscript import when , window , document
3- from js import Math , THREE , performance , Object
4+ from js import Math , performance
45import asyncio
56
67mouse = THREE .Vector2 .new ()
@@ -42,11 +43,9 @@ def mathRandom(num = 1):
4243particularGroup = THREE .Object3D .new ()
4344modularGroup = THREE .Object3D .new ()
4445
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 })
4747
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 })
5049
5150def create_cubes (mathRandom , modularGroup ):
5251 i = 0
@@ -108,11 +107,12 @@ def generateParticle(mathRandom, particularGroup, num, amp = 2):
108107lightBack .position .set (0 , - 3 , - 1 )
109108
110109scene .add (sceneGroup )
111- scene .add (light )
112- scene .add (lightBack )
110+ #scene.add(light)
111+ #scene.add(lightBack)
112+ #scene.add(ambientLight)
113113
114- rectSize = 2
115- intensity = 14
114+ rectSize = 3
115+ intensity = 44
116116rectLight = THREE .RectAreaLight .new ( 0x0FFFFF , intensity , rectSize , rectSize )
117117rectLight .position .set ( 0 , 0 , 1 )
118118rectLight .lookAt ( 0 , 0 , 0 )
@@ -155,4 +155,4 @@ async def main():
155155 renderer .render ( scene , camera )
156156 await asyncio .sleep (0.02 )
157157
158- asyncio . ensure_future ( main () )
158+ main ()
0 commit comments