It looks like you're new here. If you want to get involved, click one of these buttons!
application:setBackgroundColor(0x0) application:configureFrustum(120) --I first make the SVG object local path = Path2D.new() path:setPosition(140, 10) path:setFillColor(0xb87e43, 1) path:setLineColor(0xFFFFFF) path:setSvgPath("M 0.00 40.42 C 7.03 35.03 14.13 29.73 21.19 24.38 C 28.51 29.55 35.47 35.21 42.87 40.27 C 49.96 35.03 56.90 29.59 64.01 24.38 C 71.10 29.60 78.06 35.01 85.12 40.28 C 92.54 35.23 99.49 29.54 106.83 24.38 C 113.89 29.68 120.87 35.10 128.00 40.31 L 128.00 128.00 L 0.00 128.00 L 0.00 40.42 Z") --then I add it to a 3d mesh local mesh = Mesh.new(true) mesh:addChild(path) stage:addChild(mesh) stage:setScale(5) --now I tween the rotationY from 0 to 95 local rotY = 0 stage:addEventListener(Event.ENTER_FRAME, function() rotY = rotY + 1 path:setRotationY(rotY) end) |
Comments
The only option I can think of is rendering your shape to a render target and display that rendertarget in 3D
I used a render target and it does work, but it's a raster graphic, which shows pixels (instead of a smooth vector) when the view is zoomed in.
What's interesting is that using a Shape (+MoveTo/LineTo) works, but Shape is quite limited in what it can draw (i.e just rectangles). Of course you can manually draw curves with a Shape, but it's not resolution independent.
I think a viable option would be to increase the resolution of the rendertarget as the user approaches the 3d object.
Thanks, I'll work something out.
disadvantages:
- it does not have border
- for curves you need to subdivide the curve and then apply poly2tri, so additional hassle.
perhaps there could be an option so that path2d fills in this way and then it's fully 3d-compatible.
Fragmenter - animated loop machine and IKONOMIKON - the memory game