Explore all 3D Animation open source software, libraries, packages, source code, cloud functions and APIs.

Popular New Releases in 3D Animation

assimp

The Assimp 5.2.3 Bugfix-Release

s2geometry

v0.10.0

sverchok

Sverchok v1.0

blockbench

4.2.2

polyscope

v1.3.0

Popular Libraries in 3D Animation

assimp

by assimp doticonc++doticon

star image 7677 doticonNOASSERTION

The official Open-Asset-Importer-Library Repository. Loads 40+ 3D-file-formats into one unified and clean data structure.

angle

by google doticonc++doticon

star image 2127 doticonNOASSERTION

A conformant OpenGL ES implementation for Windows, Mac, Linux, iOS and Android.

s2geometry

by google doticonc++doticon

star image 1747 doticonApache-2.0

Computational geometry and spatial indexing on the sphere

sverchok

by nortikin doticonpythondoticon

star image 1688 doticonGPL-3.0

Sverchok

rayshader

by tylermorganwall doticonrdoticon

star image 1527 doticon

R Package for 2D and 3D mapping and data visualization

blockbench

by JannisX11 doticonjavascriptdoticon

star image 1025 doticonGPL-3.0

Blockbench - A low poly 3D model editor

ezy-slice

by DavidArayan doticoncsharpdoticon

star image 1006 doticonMIT

An open source mesh slicer framework for Unity3D Game Engine. Written in C#.

transform360

by facebook doticoncdoticon

star image 915 doticonNOASSERTION

Transform360 is an equirectangular to cubemap transform for 360 video.

smplify-x

by vchoutas doticonpythondoticon

star image 914 doticonNOASSERTION

Expressive Body Capture: 3D Hands, Face, and Body from a Single Image

Trending New libraries in 3D Animation

STAR

by ahmedosman doticonpythondoticon

star image 330 doticonNOASSERTION

ECCV2020 - Official code repository for the paper : STAR - A Sparse Trained Articulated Human Body Regressor

bevy_mod_picking

by aevyrie doticonrustdoticon

star image 200 doticonMIT

Unofficial 3D mouse picking plugin for Bevy

geometry-free-view-synthesis

by CompVis doticonpythondoticon

star image 167 doticonMIT

Is a geometric model required to synthesize novel views from a single image?

NVISII

by owl-project doticonc++doticon

star image 152 doticonApache-2.0

three-loader-3dtiles

by nytimes doticontypescriptdoticon

star image 150 doticonNOASSERTION

This is a Three.js loader module for handling OGC 3D Tiles, created by Cesium. It currently supports the two main formats, Batched 3D Model (b3dm) - based on glTF Point cloud.

TerrainPrettifier

by Fewes doticoncsharpdoticon

star image 145 doticon

A small GPU-based component designed to aid in cleaning and refining satellite/DEM based terrains directly inside Unity.

taiwan-atlas

by dkaoster doticonjavascriptdoticon

star image 119 doticonMIT

Pre-built TopoJSON from the Ministry of the Interior.

hello-webgpu

by cwoffenden doticonc++doticon

star image 114 doticon

Cross-platform C++ example for WebGPU and Dawn

taichi_three

by taichi-dev doticonpythondoticon

star image 112 doticonMIT

A soft renderer based on Taichi (work in progress)

Top Authors in 3D Animation

1

mattdesl

5 Libraries

star icon29

2

tudelft3d

4 Libraries

star icon111

3

strawlab

4 Libraries

star icon109

4

jeromeetienne

3 Libraries

star icon62

5

mcoder2014

3 Libraries

star icon55

6

mapbox

3 Libraries

star icon723

7

rlk

3 Libraries

star icon33

8

TomLBZ

2 Libraries

star icon8

9

podgorskiy

2 Libraries

star icon45

10

chrisdickinson

2 Libraries

star icon40

1

5 Libraries

star icon29

2

4 Libraries

star icon111

3

4 Libraries

star icon109

4

3 Libraries

star icon62

5

3 Libraries

star icon55

6

3 Libraries

star icon723

7

3 Libraries

star icon33

8

2 Libraries

star icon8

9

2 Libraries

star icon45

10

2 Libraries

star icon40

Trending Kits in 3D Animation

Here are some famous React Animation Bot Libraries. Some of the use cases of React Animation Libraries include Creating custom page transitions, animating user interface elements, animating data visualisations, Animating complex user interfaces. 


React animation libraries are JavaScript libraries that provide a set of tools to animate components in a React application. These libraries make it easy to animate various components such as buttons, dropdowns, modals, and other user interface elements. They provide powerful APIs that allow developers to create complex animations with minimal code. 


Let us look at the libraries in detail below. 

react-spring 

  • Utilizes physical equations and damping functions to create realistic and natural animations. 
  • Integrates with any other animation library. 
  • Highly optimized for performance, making it a great choice for complex animations. 

react-native-reanimated 

  • Support for both imperative and declarative APIs. 
  • Support for interpolation and value transformations. 
  • Ability to use native platform-specific animations (e.g., spring animations on iOS). 

animated 

  • Provides a comprehensive and flexible API for declarative and imperative animation control. 
  • Only library to offer React Native support. 
  • Allows developers to animate components directly from the React Native bridge.

react-anime 

  • Modular structure allows developers to create custom animations from individual components. 
  • Allows developers to create smooth transitions between different states of their animation. 
  • Offers unique easing functions to create a variety of animation styles. 

react-animation 

  • Supports both CSS and JavaScript animations, making it easy to customize and animate components. 
  • Offers a wide variety of animations such as sliding, fading, and scaling. 
  • Allows developers to chain multiple animations together to create complex sequences. 

moti 

  • Advanced features such as timeline-based animation sequencing. 
  • Supports both native and JavaScript-based animations. 
  • Includes an extensive library of pre-built animations. 

Resonance 

  • Offers a robust set of tools to customize and manage animations. 
  • Designed to be performant, meaning that animations run smoothly on all devices. 
  • Provides an easy way to create complex animations, along with a variety of interpolation methods and easing functions. 

react-animation-comparison 

  • Provides a comprehensive suite of tools and features. 
  • Powerful animation library and an intuitive GUI. 
  • Has a built-in timeline and animation editor. 

renature 

  • Lightweight library that is designed to make animations easy to implement. 
  • It offers a wide range of animation options. 
  • Provides an animation editor that allows users to generate animations quickly and easily. 

Lottie-react 

  • Completely open-source, allowing developers to customize and extend the library as they see fit. 
  • Extremely lightweight and fast-loading. 
  • Declarative API for easily adding complex animations to React components. 

Trending Discussions on 3D Animation

Animation Progress Bar Three.js

how to control 3D object of seized resource?

CSS @keyframes translate3d Compatibility

Anylogic Heavy 3D Animation is stopping the model animation on runtime

Making a trail animation for the N body problem

Python - 3D gradient plot animation with control slider

Bug: React does not recognize the allowTransparency prop on a DOM element

mouse movent event not same coords

Random animations in WebGL

Replacing all single quotes outside of brackets to parse to valid json

QUESTION

Animation Progress Bar Three.js

Asked 2022-Feb-16 at 20:09

How do I make an animation progress bar in three.js? I've been stuck on this problem for quite some time. I tried to use the html5 video player progress bar approach. But It seems it doesn't work for 3d animations.

1var loader = new GLTFLoader()
2loader.load( './resources/full_case/mymodel.glb', function ( gltf ) {
3    gltf.scene.scale.set(0.1,0.1,0.1)
4    gltf.scene.position.set(0,0,-150)
5    gltf.scene.rotation.set(0, Math.PI * 2, 0)
6    scene.add( gltf.scene );
7    mixer = new THREE.AnimationMixer( gltf.scene );
8    gltf.animations.forEach( ( clip ) => {
9      let animation =  mixer.clipAction( clip );
10        animation.setLoop(THREE.LoopOnce)
11        animation.clampWhenFinished = true;
12        animation.timeScale = 1
13          animation.play()
14    } );
15
16  } );
17

ANSWER

Answered 2022-Feb-16 at 20:09

Maybe you'd want to create a progress bar in HTML instead, and then display it on top of that scene.

HTML:

1var loader = new GLTFLoader()
2loader.load( './resources/full_case/mymodel.glb', function ( gltf ) {
3    gltf.scene.scale.set(0.1,0.1,0.1)
4    gltf.scene.position.set(0,0,-150)
5    gltf.scene.rotation.set(0, Math.PI * 2, 0)
6    scene.add( gltf.scene );
7    mixer = new THREE.AnimationMixer( gltf.scene );
8    gltf.animations.forEach( ( clip ) => {
9      let animation =  mixer.clipAction( clip );
10        animation.setLoop(THREE.LoopOnce)
11        animation.clampWhenFinished = true;
12        animation.timeScale = 1
13          animation.play()
14    } );
15
16  } );
17<label for="loading">Progress bar:</label>
18<progress id="loading" value="50" max="100">50%</progress>
19

You will notice that this won't be on top of the scene, rather, it would be pushing the scene lower.

In order to fix that, you need to create a class called ui, which you can user for any type of HTML that you want to display as user interface.

CSS:

1var loader = new GLTFLoader()
2loader.load( './resources/full_case/mymodel.glb', function ( gltf ) {
3    gltf.scene.scale.set(0.1,0.1,0.1)
4    gltf.scene.position.set(0,0,-150)
5    gltf.scene.rotation.set(0, Math.PI * 2, 0)
6    scene.add( gltf.scene );
7    mixer = new THREE.AnimationMixer( gltf.scene );
8    gltf.animations.forEach( ( clip ) => {
9      let animation =  mixer.clipAction( clip );
10        animation.setLoop(THREE.LoopOnce)
11        animation.clampWhenFinished = true;
12        animation.timeScale = 1
13          animation.play()
14    } );
15
16  } );
17<label for="loading">Progress bar:</label>
18<progress id="loading" value="50" max="100">50%</progress>
19.ui {
20    position: absolute;
21}
22

Then you should make sure to add the class to the progress bar.

1var loader = new GLTFLoader()
2loader.load( './resources/full_case/mymodel.glb', function ( gltf ) {
3    gltf.scene.scale.set(0.1,0.1,0.1)
4    gltf.scene.position.set(0,0,-150)
5    gltf.scene.rotation.set(0, Math.PI * 2, 0)
6    scene.add( gltf.scene );
7    mixer = new THREE.AnimationMixer( gltf.scene );
8    gltf.animations.forEach( ( clip ) => {
9      let animation =  mixer.clipAction( clip );
10        animation.setLoop(THREE.LoopOnce)
11        animation.clampWhenFinished = true;
12        animation.timeScale = 1
13          animation.play()
14    } );
15
16  } );
17<label for="loading">Progress bar:</label>
18<progress id="loading" value="50" max="100">50%</progress>
19.ui {
20    position: absolute;
21}
22<progress class="ui" id="loading" value="50" max="100">50%</progress>
23

After that, you can use positioning css selectors to place the progress bar to the correct position, such as top, bottom, left, right, margin, padding, and more.

Source https://stackoverflow.com/questions/70545375

QUESTION

how to control 3D object of seized resource?

Asked 2021-Dec-07 at 19:48

I have a truck agent that seizes a trailer resource from "trailer" resourcepoolblock (thanks to seize block). I want that both the agent both the resource make a rotation in the 3D animation. I did for the agent, while for the resource i tried: "agent.resourceUnitsOfPool(trailer).trailer1.setRotation(-PI);" But it does not work. What is the right command in order to control the 3D object of the resource? Thanks for the help.

ANSWER

Answered 2021-Dec-07 at 19:48

resourceUnitsOfPool returns a list of all resource agents seized. Assuming you're only seizing a single trailer, you could do the following.

1agent.resourceUnitsOfPool(trailer).get(0).setRotation(-PI);
2

The above would refer to the agent and set its rotation. If you want to rotate a Shape3D object within the agent, just refer to it after the get(0).

Or you could use resourceUnitOfPool (which I assume you were trying to use. Notice unit, singular), which returns the first occurrence of resource unit of a given pool among the seized resource units, and then proceed in a similar manner.

Source https://stackoverflow.com/questions/70263670

QUESTION

CSS @keyframes translate3d Compatibility

Asked 2021-Oct-17 at 12:44

How do I specifically check for compatibility of @keyframes translate3d animations with the browser ?

Please Don't close this question since I've tried many stackoverflow solutions before asking this question.

I want to check whether the browser my webpage runs is compatible for running animations, since many android browsers(Old Ones) are not capable of running them, they just stop displaying output text when animation fails (In MY Case). So, I would like to either stop animations or redirect them to another copy of my same website without any animations :)

P.S I've also tried using @supports, but of no use :(

1h1,h2{
2            height: 40px;
3            animation: an 1s ease-out 1 both;
4        }
5    @keyframes an {
6        from {
7            opacity: 0;
8            transform: perspective(500px) translate3d(-35px, -40px, -150px) rotate3d(1, -1, 0, 35deg);
9        }
10        to {
11            opacity: 1;
12            transform: perspective(500px) translate3d(0, 0, 0);
13        }
14}
1h1,h2{
2            height: 40px;
3            animation: an 1s ease-out 1 both;
4        }
5    @keyframes an {
6        from {
7            opacity: 0;
8            transform: perspective(500px) translate3d(-35px, -40px, -150px) rotate3d(1, -1, 0, 35deg);
9        }
10        to {
11            opacity: 1;
12            transform: perspective(500px) translate3d(0, 0, 0);
13        }
14}<h1 id="h1" class="th">Test Texts</h1>
15<h2 id="h2" class="th">Also Test Texts..</div>

ANSWER

Answered 2021-Sep-24 at 11:09

Check with media query:

1h1,h2{
2            height: 40px;
3            animation: an 1s ease-out 1 both;
4        }
5    @keyframes an {
6        from {
7            opacity: 0;
8            transform: perspective(500px) translate3d(-35px, -40px, -150px) rotate3d(1, -1, 0, 35deg);
9        }
10        to {
11            opacity: 1;
12            transform: perspective(500px) translate3d(0, 0, 0);
13        }
14}<h1 id="h1" class="th">Test Texts</h1>
15<h2 id="h2" class="th">Also Test Texts..</div>@media all and (-webkit-transform-3d) {
16   css animation when supported
17};
18

Check with @supports:

1h1,h2{
2            height: 40px;
3            animation: an 1s ease-out 1 both;
4        }
5    @keyframes an {
6        from {
7            opacity: 0;
8            transform: perspective(500px) translate3d(-35px, -40px, -150px) rotate3d(1, -1, 0, 35deg);
9        }
10        to {
11            opacity: 1;
12            transform: perspective(500px) translate3d(0, 0, 0);
13        }
14}<h1 id="h1" class="th">Test Texts</h1>
15<h2 id="h2" class="th">Also Test Texts..</div>@media all and (-webkit-transform-3d) {
16   css animation when supported
17};
18@supports (transform: translate3d) {
19
20}
21

or

1h1,h2{
2            height: 40px;
3            animation: an 1s ease-out 1 both;
4        }
5    @keyframes an {
6        from {
7            opacity: 0;
8            transform: perspective(500px) translate3d(-35px, -40px, -150px) rotate3d(1, -1, 0, 35deg);
9        }
10        to {
11            opacity: 1;
12            transform: perspective(500px) translate3d(0, 0, 0);
13        }
14}<h1 id="h1" class="th">Test Texts</h1>
15<h2 id="h2" class="th">Also Test Texts..</div>@media all and (-webkit-transform-3d) {
16   css animation when supported
17};
18@supports (transform: translate3d) {
19
20}
21@supports not (transform: translate3d) {
22
23}
24

or you can check out this javascript solution https://gist.github.com/lorenzopolidori/3794226

Source https://stackoverflow.com/questions/69312365

QUESTION

Anylogic Heavy 3D Animation is stopping the model animation on runtime

Asked 2021-Sep-21 at 18:29

I am running a model with heavy 3D animation images for agents. At the beginning, the model was running fine, but then I added new agent types with 3D images (without creating any agent instances) and now when it runs the animation window just freezes, even when the model in the background keeps running. While ignoring the 3D window the model runs without any issue. Other than decreasing the size and complexity of the 3D images, is there something that can be done for making the model run bigger 3D instances? Thank you.

ANSWER

Answered 2021-Sep-21 at 18:29

You can play with the "draw distance" setting in the 3D-window properties, maybe that helps.

Also, try to move the 3D window into its own agent and navigate there only when the user wants it, i.e. normal model animation shows some plots and charts on Main (or whatever your root agent is).

Apart from that: use simpler 3D models. Remember that the engine runs in a browser, it is not Unity :)

Source https://stackoverflow.com/questions/69273445

QUESTION

Making a trail animation for the N body problem

Asked 2021-Sep-20 at 18:14

I solved the N body problem with Python. My code works perfectly but I have to write manually line animation for each body. I would like to make a loop instead but I did not succeed. Here is the code :

1import numpy as np
2import matplotlib.pyplot as plt
3from matplotlib import animation
4from scipy.integrate import odeint
5from mpl_toolkits import mplot3d
6from mpl_toolkits.mplot3d import Axes3D
7
8
9
10## Constantes dimensionnées du système
11N = 4
12G = 6.674e-11
13M = np.random.uniform(low=1e30, high=3e30, size=N)
14
15## Constantes adimensionnées du système
16G = G * (6e24 * (365*24*60*60)**2) / (1.496e11)**3
17M = M/6e24
18
19## Conditions initiales
20ti = 0
21tf = 10
22n = 500
23dt = (tf-ti)/n
24T = np.linspace(ti, tf, n)
25
26R0 = np.random.uniform(low=-4, high=4, size=3*N)
27V0 = np.random.uniform(low=-1, high=1, size=3*N)
28Y0 = np.append(R0,V0)
29
30def NCorps(Yk, t):
31
32    #Création tableau contenant les positions de tous les corps
33    Rk = np.zeros((3,N))
34    a = 0
35    b = 0
36    c = 0
37    for i in range(0,3*N):
38        if i%3 == 0:
39            Rk[0,a] = Yk[i]
40            a = a+1
41        if i%3 == 1:
42            Rk[1,b] = Yk[i]
43            b = b+1
44        if i%3 == 2:
45            Rk[2,c] = Yk[i]
46            c = c+1
47
48    #Création tableau contenant les vitesses et les accélérations de tous les corps
49    Sk = []
50    
51    for i in range(3*N, 6*N):
52            Sk.append(Yk[i])
53
54    for i in range(0, N):
55        axk = 0
56        ayk = 0
57        azk = 0
58        for j in range(0, N):
59            if j != i:
60                axk = axk - G*M[j]*(Rk[0,i]-Rk[0,j])/((Rk[0,i]-Rk[0,j])**2+(Rk[1,i]-Rk[1,j])**2+(Rk[2,i]-Rk[2,j])**2)**(3/2)
61                ayk = ayk - G*M[j]*(Rk[1,i]-Rk[1,j])/((Rk[0,i]-Rk[0,j])**2+(Rk[1,i]-Rk[1,j])**2+(Rk[2,i]-Rk[2,j])**2)**(3/2)
62                azk = azk - G*M[j]*(Rk[2,i]-Rk[2,j])/((Rk[0,i]-Rk[0,j])**2+(Rk[1,i]-Rk[1,j])**2+(Rk[2,i]-Rk[2,j])**2)**(3/2)
63        Sk.append(axk)
64        Sk.append(ayk)
65        Sk.append(azk)
66    return Sk
67
68
69Y = odeint(NCorps, Y0, T)
70
71
72## Plot 3D image
73
74fig = plt.figure()
75ax = plt.axes(projection = '3d')
76
77a=0
78for i in range(0, 3*N):
79    if i%3 == 0:
80        ax.plot3D(Y[:,i], Y[:,i+1], Y[:,i+2], label = "Corps " + str(a))
81        ax.scatter(Y[-1,i], Y[-1,i+1], Y[-1,i+2], marker = "o", s = 75)
82        a = a+1
83
84ax.set_xlim3d(-7, 7)
85ax.set_ylim3d(-7, 7)
86ax.set_zlim3d(-7, 7)
87ax.set_xlabel("x (UA)")
88ax.set_ylabel("y (UA)")
89ax.set_zlabel("z (UA)")
90plt.legend()
91
92
93## Plot 3D animation
94
95fig = plt.figure()
96ax = plt.axes(projection = '3d')
97
98ax.set_xlim3d(-7, 7)
99ax.set_ylim3d(-7, 7)
100ax.set_zlim3d(-7, 7)
101ax.set_xlabel("x (UA)")
102ax.set_ylabel("y (UA)")
103ax.set_zlabel("z (UA)")
104
105trail = [50]*N
106
107###########################################################################################
108########## HERE IS MY PROBLEM : HOW TO MAKE Animate3D FUNCTION WORK FOR N BODY ? ##########
109###########################################################################################
110
111def Animate3D(k):
112    ligne1.set_data(Y[k:max(1,k-trail[0]):-1, 0], Y[k:max(1,k-trail[0]):-1, 1])
113    ligne1.set_3d_properties(Y[k:max(1,k-trail[0]):-1, 2])
114    
115    ligne2.set_data(Y[k:max(1,k-trail[1]):-1, 3], Y[k:max(1,k-trail[1]):-1, 4])
116    ligne2.set_3d_properties(Y[k:max(1,k-trail[1]):-1, 5])
117
118    ligne3.set_data(Y[k:max(1,k-trail[2]):-1, 6], Y[k:max(1,k-trail[2]):-1, 7])
119    ligne3.set_3d_properties(Y[k:max(1,k-trail[2]):-1, 8])
120    
121    return (ligne1, ligne2, ligne3)
122
123ligne1, = ax.plot([], [], "o-", markevery = 10000)
124ligne2, = ax.plot([], [], "o-", markevery = 10000)
125ligne3, = ax.plot([], [], "o-", markevery = 10000)
126
127anim3D = animation.FuncAnimation(fig, Animate3D, frames = n, interval = 30, blit = False)
128
129plt.show()
130

As you can see in the last part, I have no idea how to generalize the Animate3D function for the N body. I wanted to create a loop like the one bellow :

1import numpy as np
2import matplotlib.pyplot as plt
3from matplotlib import animation
4from scipy.integrate import odeint
5from mpl_toolkits import mplot3d
6from mpl_toolkits.mplot3d import Axes3D
7
8
9
10## Constantes dimensionnées du système
11N = 4
12G = 6.674e-11
13M = np.random.uniform(low=1e30, high=3e30, size=N)
14
15## Constantes adimensionnées du système
16G = G * (6e24 * (365*24*60*60)**2) / (1.496e11)**3
17M = M/6e24
18
19## Conditions initiales
20ti = 0
21tf = 10
22n = 500
23dt = (tf-ti)/n
24T = np.linspace(ti, tf, n)
25
26R0 = np.random.uniform(low=-4, high=4, size=3*N)
27V0 = np.random.uniform(low=-1, high=1, size=3*N)
28Y0 = np.append(R0,V0)
29
30def NCorps(Yk, t):
31
32    #Création tableau contenant les positions de tous les corps
33    Rk = np.zeros((3,N))
34    a = 0
35    b = 0
36    c = 0
37    for i in range(0,3*N):
38        if i%3 == 0:
39            Rk[0,a] = Yk[i]
40            a = a+1
41        if i%3 == 1:
42            Rk[1,b] = Yk[i]
43            b = b+1
44        if i%3 == 2:
45            Rk[2,c] = Yk[i]
46            c = c+1
47
48    #Création tableau contenant les vitesses et les accélérations de tous les corps
49    Sk = []
50    
51    for i in range(3*N, 6*N):
52            Sk.append(Yk[i])
53
54    for i in range(0, N):
55        axk = 0
56        ayk = 0
57        azk = 0
58        for j in range(0, N):
59            if j != i:
60                axk = axk - G*M[j]*(Rk[0,i]-Rk[0,j])/((Rk[0,i]-Rk[0,j])**2+(Rk[1,i]-Rk[1,j])**2+(Rk[2,i]-Rk[2,j])**2)**(3/2)
61                ayk = ayk - G*M[j]*(Rk[1,i]-Rk[1,j])/((Rk[0,i]-Rk[0,j])**2+(Rk[1,i]-Rk[1,j])**2+(Rk[2,i]-Rk[2,j])**2)**(3/2)
62                azk = azk - G*M[j]*(Rk[2,i]-Rk[2,j])/((Rk[0,i]-Rk[0,j])**2+(Rk[1,i]-Rk[1,j])**2+(Rk[2,i]-Rk[2,j])**2)**(3/2)
63        Sk.append(axk)
64        Sk.append(ayk)
65        Sk.append(azk)
66    return Sk
67
68
69Y = odeint(NCorps, Y0, T)
70
71
72## Plot 3D image
73
74fig = plt.figure()
75ax = plt.axes(projection = '3d')
76
77a=0
78for i in range(0, 3*N):
79    if i%3 == 0:
80        ax.plot3D(Y[:,i], Y[:,i+1], Y[:,i+2], label = "Corps " + str(a))
81        ax.scatter(Y[-1,i], Y[-1,i+1], Y[-1,i+2], marker = "o", s = 75)
82        a = a+1
83
84ax.set_xlim3d(-7, 7)
85ax.set_ylim3d(-7, 7)
86ax.set_zlim3d(-7, 7)
87ax.set_xlabel("x (UA)")
88ax.set_ylabel("y (UA)")
89ax.set_zlabel("z (UA)")
90plt.legend()
91
92
93## Plot 3D animation
94
95fig = plt.figure()
96ax = plt.axes(projection = '3d')
97
98ax.set_xlim3d(-7, 7)
99ax.set_ylim3d(-7, 7)
100ax.set_zlim3d(-7, 7)
101ax.set_xlabel("x (UA)")
102ax.set_ylabel("y (UA)")
103ax.set_zlabel("z (UA)")
104
105trail = [50]*N
106
107###########################################################################################
108########## HERE IS MY PROBLEM : HOW TO MAKE Animate3D FUNCTION WORK FOR N BODY ? ##########
109###########################################################################################
110
111def Animate3D(k):
112    ligne1.set_data(Y[k:max(1,k-trail[0]):-1, 0], Y[k:max(1,k-trail[0]):-1, 1])
113    ligne1.set_3d_properties(Y[k:max(1,k-trail[0]):-1, 2])
114    
115    ligne2.set_data(Y[k:max(1,k-trail[1]):-1, 3], Y[k:max(1,k-trail[1]):-1, 4])
116    ligne2.set_3d_properties(Y[k:max(1,k-trail[1]):-1, 5])
117
118    ligne3.set_data(Y[k:max(1,k-trail[2]):-1, 6], Y[k:max(1,k-trail[2]):-1, 7])
119    ligne3.set_3d_properties(Y[k:max(1,k-trail[2]):-1, 8])
120    
121    return (ligne1, ligne2, ligne3)
122
123ligne1, = ax.plot([], [], "o-", markevery = 10000)
124ligne2, = ax.plot([], [], "o-", markevery = 10000)
125ligne3, = ax.plot([], [], "o-", markevery = 10000)
126
127anim3D = animation.FuncAnimation(fig, Animate3D, frames = n, interval = 30, blit = False)
128
129plt.show()
130j=0
131lignes = []
132for i in range(0, N):
133    lignes.append(ligne + i)
134
135def Animate3D(k):
136    for i in range(0, 3*N):
137        if i%3 == 0:
138            ligne + i + .set_data(Y[k:max(1,k-trail[j]):-1, i], Y[k:max(1,k-trail[j]):-1, i+1])
139            ligne + i + .set_3d_properties(Y[k:max(1,k-trail[j]):-1, i+2])
140            j=j+1
141    
142    return lignes
143
144for i in range(0, N):
145    ligne + i + , = ax.plot([], [], "o-", markevery = 10000)
146

Obviously it does not work.

ANSWER

Answered 2021-Sep-20 at 18:11

You should collect lignes in a list and loop over them. In order to update counters within Animate3D, you can replace range with enumerate, as in the code below:

1import numpy as np
2import matplotlib.pyplot as plt
3from matplotlib import animation
4from scipy.integrate import odeint
5from mpl_toolkits import mplot3d
6from mpl_toolkits.mplot3d import Axes3D
7
8
9
10## Constantes dimensionnées du système
11N = 4
12G = 6.674e-11
13M = np.random.uniform(low=1e30, high=3e30, size=N)
14
15## Constantes adimensionnées du système
16G = G * (6e24 * (365*24*60*60)**2) / (1.496e11)**3
17M = M/6e24
18
19## Conditions initiales
20ti = 0
21tf = 10
22n = 500
23dt = (tf-ti)/n
24T = np.linspace(ti, tf, n)
25
26R0 = np.random.uniform(low=-4, high=4, size=3*N)
27V0 = np.random.uniform(low=-1, high=1, size=3*N)
28Y0 = np.append(R0,V0)
29
30def NCorps(Yk, t):
31
32    #Création tableau contenant les positions de tous les corps
33    Rk = np.zeros((3,N))
34    a = 0
35    b = 0
36    c = 0
37    for i in range(0,3*N):
38        if i%3 == 0:
39            Rk[0,a] = Yk[i]
40            a = a+1
41        if i%3 == 1:
42            Rk[1,b] = Yk[i]
43            b = b+1
44        if i%3 == 2:
45            Rk[2,c] = Yk[i]
46            c = c+1
47
48    #Création tableau contenant les vitesses et les accélérations de tous les corps
49    Sk = []
50    
51    for i in range(3*N, 6*N):
52            Sk.append(Yk[i])
53
54    for i in range(0, N):
55        axk = 0
56        ayk = 0
57        azk = 0
58        for j in range(0, N):
59            if j != i:
60                axk = axk - G*M[j]*(Rk[0,i]-Rk[0,j])/((Rk[0,i]-Rk[0,j])**2+(Rk[1,i]-Rk[1,j])**2+(Rk[2,i]-Rk[2,j])**2)**(3/2)
61                ayk = ayk - G*M[j]*(Rk[1,i]-Rk[1,j])/((Rk[0,i]-Rk[0,j])**2+(Rk[1,i]-Rk[1,j])**2+(Rk[2,i]-Rk[2,j])**2)**(3/2)
62                azk = azk - G*M[j]*(Rk[2,i]-Rk[2,j])/((Rk[0,i]-Rk[0,j])**2+(Rk[1,i]-Rk[1,j])**2+(Rk[2,i]-Rk[2,j])**2)**(3/2)
63        Sk.append(axk)
64        Sk.append(ayk)
65        Sk.append(azk)
66    return Sk
67
68
69Y = odeint(NCorps, Y0, T)
70
71
72## Plot 3D image
73
74fig = plt.figure()
75ax = plt.axes(projection = '3d')
76
77a=0
78for i in range(0, 3*N):
79    if i%3 == 0:
80        ax.plot3D(Y[:,i], Y[:,i+1], Y[:,i+2], label = "Corps " + str(a))
81        ax.scatter(Y[-1,i], Y[-1,i+1], Y[-1,i+2], marker = "o", s = 75)
82        a = a+1
83
84ax.set_xlim3d(-7, 7)
85ax.set_ylim3d(-7, 7)
86ax.set_zlim3d(-7, 7)
87ax.set_xlabel("x (UA)")
88ax.set_ylabel("y (UA)")
89ax.set_zlabel("z (UA)")
90plt.legend()
91
92
93## Plot 3D animation
94
95fig = plt.figure()
96ax = plt.axes(projection = '3d')
97
98ax.set_xlim3d(-7, 7)
99ax.set_ylim3d(-7, 7)
100ax.set_zlim3d(-7, 7)
101ax.set_xlabel("x (UA)")
102ax.set_ylabel("y (UA)")
103ax.set_zlabel("z (UA)")
104
105trail = [50]*N
106
107###########################################################################################
108########## HERE IS MY PROBLEM : HOW TO MAKE Animate3D FUNCTION WORK FOR N BODY ? ##########
109###########################################################################################
110
111def Animate3D(k):
112    ligne1.set_data(Y[k:max(1,k-trail[0]):-1, 0], Y[k:max(1,k-trail[0]):-1, 1])
113    ligne1.set_3d_properties(Y[k:max(1,k-trail[0]):-1, 2])
114    
115    ligne2.set_data(Y[k:max(1,k-trail[1]):-1, 3], Y[k:max(1,k-trail[1]):-1, 4])
116    ligne2.set_3d_properties(Y[k:max(1,k-trail[1]):-1, 5])
117
118    ligne3.set_data(Y[k:max(1,k-trail[2]):-1, 6], Y[k:max(1,k-trail[2]):-1, 7])
119    ligne3.set_3d_properties(Y[k:max(1,k-trail[2]):-1, 8])
120    
121    return (ligne1, ligne2, ligne3)
122
123ligne1, = ax.plot([], [], "o-", markevery = 10000)
124ligne2, = ax.plot([], [], "o-", markevery = 10000)
125ligne3, = ax.plot([], [], "o-", markevery = 10000)
126
127anim3D = animation.FuncAnimation(fig, Animate3D, frames = n, interval = 30, blit = False)
128
129plt.show()
130j=0
131lignes = []
132for i in range(0, N):
133    lignes.append(ligne + i)
134
135def Animate3D(k):
136    for i in range(0, 3*N):
137        if i%3 == 0:
138            ligne + i + .set_data(Y[k:max(1,k-trail[j]):-1, i], Y[k:max(1,k-trail[j]):-1, i+1])
139            ligne + i + .set_3d_properties(Y[k:max(1,k-trail[j]):-1, i+2])
140            j=j+1
141    
142    return lignes
143
144for i in range(0, N):
145    ligne + i + , = ax.plot([], [], "o-", markevery = 10000)
146def Animate3D(k):
147    for i, ligne in enumerate(lignes, 0):
148        ligne.set_data(Y[k:max(1, k - trail[0]):-1, 3*i], Y[k:max(1, k - trail[0]):-1, 3*i + 1])
149        ligne.set_3d_properties(Y[k:max(1, k - trail[0]):-1, 2])
150
151    return lignes
152
153
154lignes = [ax.plot([], [], "o-", markevery = 10000)[0] for _ in range(N)]
155
156anim3D = animation.FuncAnimation(fig, Animate3D, frames = n, interval = 30, blit = False)
157
158plt.show()
159

enter image description here

Source https://stackoverflow.com/questions/69258544

QUESTION

Python - 3D gradient plot animation with control slider

Asked 2021-Sep-06 at 19:12

I am reading the following articles 3D animation using matplotlib. It shows the animation in 3D.

I am considering the following scenario:

  1. I have a x-y meshgrid, [1,2,...,20] X [1,2,...,20]
  2. For each point, a z-value is assigned.
  3. Based on 1. and 2., I plot the 3-D gradient graph as the following

enter image description here

Suppose I have 5 20X20 data for z values (.xlsx). Therefore, I get 5 different graphs as above.

Now, I want to plot all 5 graphs in one graph but with a slider such that when I move the slider from 1 to 5, I can get an animation (variation) of the graph but in the same meshgrid.

The code for only one graph (one data) is provided here

1fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
2rm = pd.read_excel("test_3d.xlsx", header = None)
3rec = np.shape(rm)
4X = np.arange(1,rec[1]+1,1)
5Y = np.arange(1,rec[0]+1,1)
6x , y = np.meshgrid(X,Y)
7# Plot the surface.
8
9surf = ax.plot_surface(x, y, rm, cmap=cm.coolwarm,
10                       linewidth=0, antialiased=False)
11
12# Customize the z axis.
13ax.set_zlim(-110, -80)
14ax.zaxis.set_major_locator(LinearLocator(10))
15# A StrMethodFormatter is used automatically
16ax.zaxis.set_major_formatter('{x:.02f}')
17
18# Add a color bar which maps values to colors.
19fig.colorbar(surf, shrink=0.5, aspect=5)
20plt.show()
21

How to modified the code to get what I want? A hint please. Thanks!

ANSWER

Answered 2021-Sep-06 at 19:12

If you create an animation, the plot won't be interactive: the animation will repeat and in each frame a different surface will be shown, but you won't be able to interact with it. Since you mentioned a slider, I suppose you want an interactive plot, that will be updated after a user will change a value of a slider. This is substantially different from an animation.
Here I describe how you can set up an interactive slider.
You should create one axis for the 3D plot and another one for the slider:

1fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
2rm = pd.read_excel("test_3d.xlsx", header = None)
3rec = np.shape(rm)
4X = np.arange(1,rec[1]+1,1)
5Y = np.arange(1,rec[0]+1,1)
6x , y = np.meshgrid(X,Y)
7# Plot the surface.
8
9surf = ax.plot_surface(x, y, rm, cmap=cm.coolwarm,
10                       linewidth=0, antialiased=False)
11
12# Customize the z axis.
13ax.set_zlim(-110, -80)
14ax.zaxis.set_major_locator(LinearLocator(10))
15# A StrMethodFormatter is used automatically
16ax.zaxis.set_major_formatter('{x:.02f}')
17
18# Add a color bar which maps values to colors.
19fig.colorbar(surf, shrink=0.5, aspect=5)
20plt.show()
21ax1 = fig.add_axes([0, 0, 1, 0.8], projection = '3d')  # <-- 3D plot axis
22ax2 = fig.add_axes([0.1, 0.85, 0.8, 0.1])              # <-- slider axis
23

Then you can crate and place the slider in the appropriate axis:

1fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
2rm = pd.read_excel("test_3d.xlsx", header = None)
3rec = np.shape(rm)
4X = np.arange(1,rec[1]+1,1)
5Y = np.arange(1,rec[0]+1,1)
6x , y = np.meshgrid(X,Y)
7# Plot the surface.
8
9surf = ax.plot_surface(x, y, rm, cmap=cm.coolwarm,
10                       linewidth=0, antialiased=False)
11
12# Customize the z axis.
13ax.set_zlim(-110, -80)
14ax.zaxis.set_major_locator(LinearLocator(10))
15# A StrMethodFormatter is used automatically
16ax.zaxis.set_major_formatter('{x:.02f}')
17
18# Add a color bar which maps values to colors.
19fig.colorbar(surf, shrink=0.5, aspect=5)
20plt.show()
21ax1 = fig.add_axes([0, 0, 1, 0.8], projection = '3d')  # <-- 3D plot axis
22ax2 = fig.add_axes([0.1, 0.85, 0.8, 0.1])              # <-- slider axis
23s = Slider(ax = ax2, label = 'value', valmin = 0, valmax = 5, valinit = 2)
24

At this moment it is necessary to define a function which will be called when a user will change the value of the slider. Inside the function the slider actual value is read, then the previous plot is erased and finally the new plot is drawn. It is convenient to fix x, y and z axes limits inside the updating function, so the frame of the plot will remain fixed and only the surface would change.
In the case below, I assume that the value defined in the slider moves up or down the surface, so inside the plot_surface I add z + value; you have to tailor this based on you needs (*).

1fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
2rm = pd.read_excel("test_3d.xlsx", header = None)
3rec = np.shape(rm)
4X = np.arange(1,rec[1]+1,1)
5Y = np.arange(1,rec[0]+1,1)
6x , y = np.meshgrid(X,Y)
7# Plot the surface.
8
9surf = ax.plot_surface(x, y, rm, cmap=cm.coolwarm,
10                       linewidth=0, antialiased=False)
11
12# Customize the z axis.
13ax.set_zlim(-110, -80)
14ax.zaxis.set_major_locator(LinearLocator(10))
15# A StrMethodFormatter is used automatically
16ax.zaxis.set_major_formatter('{x:.02f}')
17
18# Add a color bar which maps values to colors.
19fig.colorbar(surf, shrink=0.5, aspect=5)
20plt.show()
21ax1 = fig.add_axes([0, 0, 1, 0.8], projection = '3d')  # <-- 3D plot axis
22ax2 = fig.add_axes([0.1, 0.85, 0.8, 0.1])              # <-- slider axis
23s = Slider(ax = ax2, label = 'value', valmin = 0, valmax = 5, valinit = 2)
24def update(val):
25    value = s.val
26    ax1.cla()
27    ax1.plot_surface(x, y, z + value, cmap = cm.coolwarm, linewidth = 0, antialiased = False)
28    ax1.set_zlim(-2, 7)
29

Finally you need to link the slider to the updating function:

1fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
2rm = pd.read_excel("test_3d.xlsx", header = None)
3rec = np.shape(rm)
4X = np.arange(1,rec[1]+1,1)
5Y = np.arange(1,rec[0]+1,1)
6x , y = np.meshgrid(X,Y)
7# Plot the surface.
8
9surf = ax.plot_surface(x, y, rm, cmap=cm.coolwarm,
10                       linewidth=0, antialiased=False)
11
12# Customize the z axis.
13ax.set_zlim(-110, -80)
14ax.zaxis.set_major_locator(LinearLocator(10))
15# A StrMethodFormatter is used automatically
16ax.zaxis.set_major_formatter('{x:.02f}')
17
18# Add a color bar which maps values to colors.
19fig.colorbar(surf, shrink=0.5, aspect=5)
20plt.show()
21ax1 = fig.add_axes([0, 0, 1, 0.8], projection = '3d')  # <-- 3D plot axis
22ax2 = fig.add_axes([0.1, 0.85, 0.8, 0.1])              # <-- slider axis
23s = Slider(ax = ax2, label = 'value', valmin = 0, valmax = 5, valinit = 2)
24def update(val):
25    value = s.val
26    ax1.cla()
27    ax1.plot_surface(x, y, z + value, cmap = cm.coolwarm, linewidth = 0, antialiased = False)
28    ax1.set_zlim(-2, 7)
29s.on_changed(update)
30

This passage is not mandatory, but I suggest to call the update function just before plt.show(); in this way the initial plot that matplotlib will show will be already coherent with the initial value expressed in the slider.

Complete Code
1fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
2rm = pd.read_excel("test_3d.xlsx", header = None)
3rec = np.shape(rm)
4X = np.arange(1,rec[1]+1,1)
5Y = np.arange(1,rec[0]+1,1)
6x , y = np.meshgrid(X,Y)
7# Plot the surface.
8
9surf = ax.plot_surface(x, y, rm, cmap=cm.coolwarm,
10                       linewidth=0, antialiased=False)
11
12# Customize the z axis.
13ax.set_zlim(-110, -80)
14ax.zaxis.set_major_locator(LinearLocator(10))
15# A StrMethodFormatter is used automatically
16ax.zaxis.set_major_formatter('{x:.02f}')
17
18# Add a color bar which maps values to colors.
19fig.colorbar(surf, shrink=0.5, aspect=5)
20plt.show()
21ax1 = fig.add_axes([0, 0, 1, 0.8], projection = '3d')  # <-- 3D plot axis
22ax2 = fig.add_axes([0.1, 0.85, 0.8, 0.1])              # <-- slider axis
23s = Slider(ax = ax2, label = 'value', valmin = 0, valmax = 5, valinit = 2)
24def update(val):
25    value = s.val
26    ax1.cla()
27    ax1.plot_surface(x, y, z + value, cmap = cm.coolwarm, linewidth = 0, antialiased = False)
28    ax1.set_zlim(-2, 7)
29s.on_changed(update)
30import numpy as np
31import matplotlib.pyplot as plt
32from matplotlib import cm
33from matplotlib.widgets import Slider
34
35N = 100
36
37X = np.linspace(0, 20, N)
38Y = np.linspace(0, 20, N)
39x, y = np.meshgrid(X, Y)
40z = np.sin(x) + np.sin(y)
41
42
43fig = plt.figure()
44
45ax1 = fig.add_axes([0, 0, 1, 0.8], projection = '3d')
46ax2 = fig.add_axes([0.1, 0.85, 0.8, 0.1])
47
48s = Slider(ax = ax2, label = 'value', valmin = 0, valmax = 5, valinit = 2)
49
50def update(val):
51    value = s.val
52    ax1.cla()
53    ax1.plot_surface(x, y, z + value, cmap = cm.coolwarm, linewidth = 0, antialiased = False)
54    ax1.set_zlim(-2, 7)
55
56s.on_changed(update)
57update(0)
58
59plt.show()
60

enter image description here

(*) You mentioned:

Suppose I have 5 20X20 data for z values (.xlsx). Therefore, I get 5 different graphs as above.

So you have 5 different .xlsx files, one for each surface? In this case you have to read those files and plot them inside the update function.

Source https://stackoverflow.com/questions/68698587

QUESTION

Bug: React does not recognize the allowTransparency prop on a DOM element

Asked 2021-Sep-04 at 13:06

I'm using an iframe:

1<iframe
2                width="100%"
3                height="100%"
4                frameBorder="0"
5                title="Spline 3D Animation"
6                allowTransparency={true}
7                style={{ backgroundColor: "transparent" }}
8                src="https://my.spline.design/portfolio-fe0fd4b29cba7bfea175804f995a9f8a/"
9></iframe>
10

The console shows:

1<iframe
2                width="100%"
3                height="100%"
4                frameBorder="0"
5                title="Spline 3D Animation"
6                allowTransparency={true}
7                style={{ backgroundColor: "transparent" }}
8                src="https://my.spline.design/portfolio-fe0fd4b29cba7bfea175804f995a9f8a/"
9></iframe>
10Warning: React does not recognize the `allowTransparency` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `allowtransparency` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
11

React version: ^17.0.2

Link to code example: The entire code for this is here https://github.com/akashshyamdev/portfolio-latest/blob/master/src/containers/Home/Hero.tsx

The current behavior

Screenshot 2021-09-04 at 09 39 00

The expected behavior

I expect the black background to be transparent

ANSWER

Answered 2021-Sep-04 at 11:15
It should be allowtransparency="true"

But your iframe doesn't appear to be having any space for transparency

Source https://stackoverflow.com/questions/69054553

QUESTION

mouse movent event not same coords

Asked 2021-May-24 at 10:58

I have a 3d animation who i want to detect colitions with mouse, i try to follow with a ball and this ball is not same position than mouse.

Working example in codepen

This function is a copy paste of this other answer but it dont work for me.

1// Follows the mouse event
2function onMouseMove(event) {
3
4    // Update the mouse variable
5    event.preventDefault();
6    mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
7    mouse.y = - (event.clientY / window.innerHeight) * 2 + 1;
8
9    // Make the sphere follow the mouse
10    var vector = new THREE.Vector3(mouse.x, mouse.y, 0.5);
11    vector.unproject(camera);
12    var dir = vector.sub(camera.position).normalize();
13    var distance = - camera.position.z / dir.z;
14    var pos = camera.position.clone().add(dir.multiplyScalar(distance));
15    sphereInter.position.copy(pos);
16
17    // Make the sphere follow the mouse
18    sphereInter.position.set(event.clientX, event.clientY, 0);
19}
20

As you can see, the blue ball is not same place than mouse, how can i fix it?

ANSWER

Answered 2021-May-24 at 10:58

I suggest you add the mousemove event listener to renderer.domElement instead of document and then use this code for computing the components of mouse:

1// Follows the mouse event
2function onMouseMove(event) {
3
4    // Update the mouse variable
5    event.preventDefault();
6    mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
7    mouse.y = - (event.clientY / window.innerHeight) * 2 + 1;
8
9    // Make the sphere follow the mouse
10    var vector = new THREE.Vector3(mouse.x, mouse.y, 0.5);
11    vector.unproject(camera);
12    var dir = vector.sub(camera.position).normalize();
13    var distance = - camera.position.z / dir.z;
14    var pos = camera.position.clone().add(dir.multiplyScalar(distance));
15    sphereInter.position.copy(pos);
16
17    // Make the sphere follow the mouse
18    sphereInter.position.set(event.clientX, event.clientY, 0);
19}
20const rect = renderer.domElement.getBoundingClientRect();
21
22mouse.x = ( ( event.clientX - rect.left ) / rect.width ) * 2 - 1;
23mouse.y = - ( ( event.clientY - rect.top ) / rect.height ) * 2 + 1;
24

Source https://stackoverflow.com/questions/67670426

QUESTION

Random animations in WebGL

Asked 2021-Apr-30 at 08:44

I have a WebGL scene with tens of thousands of polygons (2d on the z=0 plane). Each polygon is composed of approximately 6-12 triangles (18-36 vertices). I would like to apply a random (or random-looking) 3d animation to each shape by applying a 4x4 transformation matrix to all the vertices in each shape.

I know I could do this by assigning a 16 number matrix to each vertex (the same matrix for all 18-36 vertices in the shape). I know this is just a bit the nature of WebGL but it seems somewhat inefficient to have 18-36 identical copies of the same 4x4 matrix.

I was wondering if there are any more efficient ways to do it. For example, is there a way to use only say 20 matrices and randomly assign a matrix to each shape? I am still learning webgl, so I am not sure if that is possible.

ANSWER

Answered 2021-Apr-30 at 08:44

From the top of my head I see three routes you can go, all of them will require you to have at least one additional "index" attribute on your vertices to know what polygon they belong to(you can probably encode that as part of the position).

For when you need to control each animation individually:

  1. Upload a bunch of transform matrices as uniforms, and index into it via additional shape index. if you really just want to alternate between a bunch of definable matrices this is probably the most efficient way of doing so.

For when you need to control each shape individually:

  1. Upload a ton of matrices through a floating point RGBA texture, 4 pixels = 1 matrix, unpack the applicable matrix in the vertex shader using the shape index as an offset into the texture.

For when you don't need explicit control:

  1. Procedurally animate your shapes in the vertex shader, use the shape index or maybe even just the position and a noise function in conjunction with a time uniform to generate your transform (matrix) on the fly, depending on the transform you need and your vertex- vs fragment shader load this can be the fastest method.

This last approach would go something like this (vertex shader code):

1float rotationY = noise(shapeIndex + time)*PI;
2vec3 translation = vec3(
3    noise(shapeIndex + 521 + time),
4    noise(shapeIndex + 123 + time),
5    noise(shapeIndex + 321 + time)
6) * 2.0 - 1.0; // adjust this scaling depending on your projection 
7mat4 transform = mat4(
8    vec4(cos(rotationY),0,sin(rotationY),0),
9    vec4(0,1,0,0),
10    vec4(-sin(rotationY),0,cos(rotationY),0),
11    vec4(translation, 1)
12);
13

Source https://stackoverflow.com/questions/67327947

QUESTION

Replacing all single quotes outside of brackets to parse to valid json

Asked 2021-Apr-29 at 12:21

I have a file I'd like to parse to json. First item looks as follows:

1{'name': 'Ravikant P.', 'username': '@exp9993', 'url': 'https://www.freelancer.com/u/exp9993', 'title': 'ASP.NET/ Graphic Design/ Web Design/WordPress/PHP', 'city': 'Indore, India', 'stars_num_reviews': ['@exp9993', '5.0', '(178 reviews)'], 'rate': '$15 USD / hour', 'reputation': ['99%', 'Jobs Completed', '87%', 'On Budget', '94%', 'On Time', '19%', 'Repeat Hire Rate'], 'review_ratings': ['5.0', '5.0', '5.0', '5.0', '5.0'], 'review_clean_project_values': ['€50.00 EUR', '$600.00 USD', '$1,300.00 AUD', '$30.00 USD', '$50.00 USD'], 'review_project_titles': ['Wordpress - Woocommerce Small Function', 'PayDash Frontend', 'Improve current website', 'Project for Ravikant P.', 'Build a page 1:1 copy from Figma design file'], "review_project_descriptions": ['Wordpress - Woocommerce Small Function', 'Very fast and efficient! Made my request in less than 2-3 hours and exactly what i asked for.\nI recommend and will come back for sure! :)', 'PayDash Frontend', 'Delivered a high value project very quickly, always helping me fix any bugs there are in the code. Very great developer and team to work with!', 'Improve current website', 'Amazing job, and nothing was too much trouble. Highly recommend!!', 'Project for Ravikant P.', 'I requested the project from him, he completed it within 30 minutes. Super quick delivery, I will definitely be using him in the future for all of my frontend web development projects.', 'Build a page 1:1 copy from Figma design file', "He did the work very quickly and was super precise about all the little details. He's the perfect person I was looking for, someone who was able to create a page for me while paying attention to all… Read more"], 'experience_title': 'N/A', 'education_title': 'bachelor of engineering', 'education_time': '2011 - 2015', 'description': 'We can make anything you want, if you can describe exactly what you want, will get the exact service until full satisfaction.    My interest lies in designing new material & do believe we are creative & can handle complications, I am always eager to learn new things & by listening carefully & asking the right questions can get to the core of the conversation quickly.        We are a Team of 9+ experienced professionals who work closely with the clients, understand their requirements, offer suggestions, and implement ideas into reality. We always think beyond the boundaries and provide user-friendly as well as high quality IT services to our customers at a very reasonable price. Our team is always dedicative to innovate from high-end E-Commerce website development to the simplest logo design needs… Read more', 'profile_skills': {'Website Design': '138', 'HTML': '129', 'Graphic Design': '115', 'PHP': '99', 'WordPress': '62', 'User Experience Design': '53', 'CSS': '26', 'User Interface / IA': '25', 'Photoshop': '17', 'C# Programming': '13', 'ASP.NET': '12', '.NET': '11', 'eCommerce': '9', 'Microsoft SQL Server': '8', 'Logo Design': '8', 'PSD to HTML': '6', 'WooCommerce': '6'}}
2

In order to be valid json, all single quotes should be converted to double quotes. However, replacing the single quotes inside any [] truncates the json. I've done some extensive searching and have not seen a way to use regex to match a text NOT contained in quotes and then change that text. Any ideas on how I would be able to parse this to json? I've included items 2 and 3 below. Any help would be so greatly appreciated! I've been stuck on this for a few days and I'm not sure what else to try...

1{'name': 'Ravikant P.', 'username': '@exp9993', 'url': 'https://www.freelancer.com/u/exp9993', 'title': 'ASP.NET/ Graphic Design/ Web Design/WordPress/PHP', 'city': 'Indore, India', 'stars_num_reviews': ['@exp9993', '5.0', '(178 reviews)'], 'rate': '$15 USD / hour', 'reputation': ['99%', 'Jobs Completed', '87%', 'On Budget', '94%', 'On Time', '19%', 'Repeat Hire Rate'], 'review_ratings': ['5.0', '5.0', '5.0', '5.0', '5.0'], 'review_clean_project_values': ['€50.00 EUR', '$600.00 USD', '$1,300.00 AUD', '$30.00 USD', '$50.00 USD'], 'review_project_titles': ['Wordpress - Woocommerce Small Function', 'PayDash Frontend', 'Improve current website', 'Project for Ravikant P.', 'Build a page 1:1 copy from Figma design file'], "review_project_descriptions": ['Wordpress - Woocommerce Small Function', 'Very fast and efficient! Made my request in less than 2-3 hours and exactly what i asked for.\nI recommend and will come back for sure! :)', 'PayDash Frontend', 'Delivered a high value project very quickly, always helping me fix any bugs there are in the code. Very great developer and team to work with!', 'Improve current website', 'Amazing job, and nothing was too much trouble. Highly recommend!!', 'Project for Ravikant P.', 'I requested the project from him, he completed it within 30 minutes. Super quick delivery, I will definitely be using him in the future for all of my frontend web development projects.', 'Build a page 1:1 copy from Figma design file', "He did the work very quickly and was super precise about all the little details. He's the perfect person I was looking for, someone who was able to create a page for me while paying attention to all… Read more"], 'experience_title': 'N/A', 'education_title': 'bachelor of engineering', 'education_time': '2011 - 2015', 'description': 'We can make anything you want, if you can describe exactly what you want, will get the exact service until full satisfaction.    My interest lies in designing new material & do believe we are creative & can handle complications, I am always eager to learn new things & by listening carefully & asking the right questions can get to the core of the conversation quickly.        We are a Team of 9+ experienced professionals who work closely with the clients, understand their requirements, offer suggestions, and implement ideas into reality. We always think beyond the boundaries and provide user-friendly as well as high quality IT services to our customers at a very reasonable price. Our team is always dedicative to innovate from high-end E-Commerce website development to the simplest logo design needs… Read more', 'profile_skills': {'Website Design': '138', 'HTML': '129', 'Graphic Design': '115', 'PHP': '99', 'WordPress': '62', 'User Experience Design': '53', 'CSS': '26', 'User Interface / IA': '25', 'Photoshop': '17', 'C# Programming': '13', 'ASP.NET': '12', '.NET': '11', 'eCommerce': '9', 'Microsoft SQL Server': '8', 'Logo Design': '8', 'PSD to HTML': '6', 'WooCommerce': '6'}}
2{'name': 'Artur', 'username': '@Appswebandroid', 'url': 'https://www.freelancer.com/u/Appswebandroid', 'title': '♛Google Certified Digital Marketing - Grow Sales♛', 'city': 'Mafra, Portugal', 'stars_num_reviews': ['@Appswebandroid', '5.0', '(71 reviews)'], 'rate': '$15 USD / hour', 'reputation': ['100%', 'Jobs Completed', '94%', 'On Budget', '97%', 'On Time', '17%', 'Repeat Hire Rate'], 'review_ratings': ['5.0', '5.0', '5.0', '5.0', '5.0'], 'review_clean_project_values': ['$10.00 USD', '$10.00 USD', '$200.00 USD', '$100.00 USD', '$196.00 USD'], 'review_project_titles': ['woodpress seo expert', 'semana adwords', 'Project for Artur', 'experto en adwords de preferencia en español', 'Google ADS expert for make a campaign today!'], "review_project_descriptions'": ['woodpress seo expert', 'Thank you', 'semana adwords', "Artur helped me setup my campaign, but he was also taking care of it during the month that we were working. I couldn't have done it myself. He helped me channel all my money to the right… Read more", 'Project for Artur', 'Great Freelancer, very pro- and reactive. Only recommend. Thank you, Artur!', 'experto en adwords de preferencia en español', 'Artur is a master of adwords and he is really helpfull. Would work with him again. Thanks :)', 'Google ADS expert for make a campaign today!', 'Good work, is an expert in google ads! Fully recommend!'], 'experience_title': 'Computer Technician - Network Installation and Management', 'experience_time': 'Feb 2018 - Jun 2020 (2 years, 4 months)', 'education_title': 'Work optimization Business', 'education_time': 'N/A', 'description': 'I have a degree in Computer Technician Installation and Network Management.  I am available to help you publicize your business to get more customers and more sales and solve web problems. I am ready to exceed my limits to satisfy every customer.  Google Certified Digital Marketing Expert  Increase your organic traffic and the average position of your keywords with SEO method.  Qualified traffic in Google Adwords, Facebook, Instagram, Linkedin campaigns.  Increase your sales for your company, in ecommerce or physical companies  We place your site on the first page of search engines.  I am a multi-site webmaster, an SEO specialist with a passion for search engines, taking your site or business to the top of Google search, following best practices.    ✅My skills:  *✔️ Google Merchant Center*✔️Facebook Ads*✔️Google Ads*✔️Instagram Ads✔️Pinterest Ads*✔️SEO*✔️WordPress*✔️Website Optimization*✔️eCommerce*✔️ Facebook Marketing**✔️Social Media… Read more', 'profile_skills': {'Internet Marketing': '35', 'Google Adwords': '27', 'Facebook Marketing': '23', 'Marketing': '22', 'Advertising': '20', 'SEO': '14', 'Social Media Marketing': '12', 'Android': '10', 'PHP': '8', 'Mobile App Development': '7', 'Google Adsense': '6', 'Website Design': '6', 'Linux': '5', 'Graphic Design': '5', 'eCommerce': '5', 'Google Analytics': '4', 'Prestashop': '4'}}
3{'name': 'Usman N.', 'username': '@futivetechnet', 'url': 'https://www.freelancer.com/u/futivetechnet', 'title': '3D/2D Design/Animation-SMM-Unity Game Development', 'city': 'Lahore, Pakistan', 'stars_num_reviews': ['@futivetechnet', '4.9', '(139 reviews)'], 'rate': '$25 USD / hour', 'reputation': ['96%', 'Jobs Completed', '96%', 'On Budget', '93%', 'On Time', '12%', 'Repeat Hire Rate'], 'review_ratings': ['5.0', '5.0', '5.0', '5.0', '5.0'], 'review_clean_project_values': ['$12,400.00 USD', '€200.00 EUR', '$150.00 USD', '€4,700.00 EUR', '•'], 'review_project_titles': ['Online Easter crepes hunt game (for kids 5-10)', 'Project for Usman N.', '12 Social media posts for Digital marketing and app development company', 'Mobile game similar to Flappy Bird (side-scroller)', 'Make character animation for 2D game'], "review_project_descriptions'": ['Online Easter crepes hunt game (for kids 5-10)', 'It was a pleasure working with Usman. They made an amazing job!', 'Project for Usman N.', "Great quality of work! It's my second project with Usman, and both were successful. Looking forward to hire him again.", '12 Social media posts for Digital marketing and app development company', 'Usman delivered the posts as per the requirements and he did multiple revisions as per our requirements', 'Mobile game similar to Flappy Bird (side-scroller)', 'Great communication, great project management and great work!', 'Make character animation for 2D game', 'Great work! Usman understands all requirements with minimum clarifications. Result is very good.'], 'experience_title': '3D/2D Design/Animation-SMM-Unity Game Development', 'experience_time': 'Mar 2010 - Present', 'education_title': 'N/A', 'education_time': 'N/A', 'description': 'We are an all in one IT services provider in this region. A team of 70+ skilled & certified professional developers, designers, video editors, 3D modellers & animators, project managers and quality assurance individuals.      Our team is dedicated in providing the work to our clients, meeting the highest quality standards, client specifications & timely delivery of services.      Mobile | PC Games Development:   - Experienced in Unity3D, iOS Swift, Cocos2D, Buildbox, including team for UI/UX designs   - Experienced in Action, Simulation, 2D platformers, multiplayer & arcade games      3D | 2D Works, CGI Graphics:   - 3D Modelling, Rigging, Rendering & Animation   - Expertise in Autodesk Maya, 3DS Max, Blender Studio, DAZ Studio, Adobe Flash & After Effects… Read more', 'profile_skills': {'Animation': '64', '3D Animation': '64', 'Mobile App Development': '53', 'Game Development': '52', 'Graphic Design': '51', 'Game Design': '47', 'Unity 3D': '26', 'Video Services': '26', 'After Effects': '26', '3D Modelling': '24', 'Android': '20', '3D Rendering': '20', 'Photoshop': '18', '3D Design': '15', 'PHP': '14', 'Video Editing': '13', 'Website Design': '13'}}
4

ANSWER

Answered 2021-Apr-29 at 12:21

As @CharlesDuffy says, you can use ast.literal_eval().

You can read the content directly from your file:

1{'name': 'Ravikant P.', 'username': '@exp9993', 'url': 'https://www.freelancer.com/u/exp9993', 'title': 'ASP.NET/ Graphic Design/ Web Design/WordPress/PHP', 'city': 'Indore, India', 'stars_num_reviews': ['@exp9993', '5.0', '(178 reviews)'], 'rate': '$15 USD / hour', 'reputation': ['99%', 'Jobs Completed', '87%', 'On Budget', '94%', 'On Time', '19%', 'Repeat Hire Rate'], 'review_ratings': ['5.0', '5.0', '5.0', '5.0', '5.0'], 'review_clean_project_values': ['€50.00 EUR', '$600.00 USD', '$1,300.00 AUD', '$30.00 USD', '$50.00 USD'], 'review_project_titles': ['Wordpress - Woocommerce Small Function', 'PayDash Frontend', 'Improve current website', 'Project for Ravikant P.', 'Build a page 1:1 copy from Figma design file'], "review_project_descriptions": ['Wordpress - Woocommerce Small Function', 'Very fast and efficient! Made my request in less than 2-3 hours and exactly what i asked for.\nI recommend and will come back for sure! :)', 'PayDash Frontend', 'Delivered a high value project very quickly, always helping me fix any bugs there are in the code. Very great developer and team to work with!', 'Improve current website', 'Amazing job, and nothing was too much trouble. Highly recommend!!', 'Project for Ravikant P.', 'I requested the project from him, he completed it within 30 minutes. Super quick delivery, I will definitely be using him in the future for all of my frontend web development projects.', 'Build a page 1:1 copy from Figma design file', "He did the work very quickly and was super precise about all the little details. He's the perfect person I was looking for, someone who was able to create a page for me while paying attention to all… Read more"], 'experience_title': 'N/A', 'education_title': 'bachelor of engineering', 'education_time': '2011 - 2015', 'description': 'We can make anything you want, if you can describe exactly what you want, will get the exact service until full satisfaction.    My interest lies in designing new material & do believe we are creative & can handle complications, I am always eager to learn new things & by listening carefully & asking the right questions can get to the core of the conversation quickly.        We are a Team of 9+ experienced professionals who work closely with the clients, understand their requirements, offer suggestions, and implement ideas into reality. We always think beyond the boundaries and provide user-friendly as well as high quality IT services to our customers at a very reasonable price. Our team is always dedicative to innovate from high-end E-Commerce website development to the simplest logo design needs… Read more', 'profile_skills': {'Website Design': '138', 'HTML': '129', 'Graphic Design': '115', 'PHP': '99', 'WordPress': '62', 'User Experience Design': '53', 'CSS': '26', 'User Interface / IA': '25', 'Photoshop': '17', 'C# Programming': '13', 'ASP.NET': '12', '.NET': '11', 'eCommerce': '9', 'Microsoft SQL Server': '8', 'Logo Design': '8', 'PSD to HTML': '6', 'WooCommerce': '6'}}
2{'name': 'Artur', 'username': '@Appswebandroid', 'url': 'https://www.freelancer.com/u/Appswebandroid', 'title': '♛Google Certified Digital Marketing - Grow Sales♛', 'city': 'Mafra, Portugal', 'stars_num_reviews': ['@Appswebandroid', '5.0', '(71 reviews)'], 'rate': '$15 USD / hour', 'reputation': ['100%', 'Jobs Completed', '94%', 'On Budget', '97%', 'On Time', '17%', 'Repeat Hire Rate'], 'review_ratings': ['5.0', '5.0', '5.0', '5.0', '5.0'], 'review_clean_project_values': ['$10.00 USD', '$10.00 USD', '$200.00 USD', '$100.00 USD', '$196.00 USD'], 'review_project_titles': ['woodpress seo expert', 'semana adwords', 'Project for Artur', 'experto en adwords de preferencia en español', 'Google ADS expert for make a campaign today!'], "review_project_descriptions'": ['woodpress seo expert', 'Thank you', 'semana adwords', "Artur helped me setup my campaign, but he was also taking care of it during the month that we were working. I couldn't have done it myself. He helped me channel all my money to the right… Read more", 'Project for Artur', 'Great Freelancer, very pro- and reactive. Only recommend. Thank you, Artur!', 'experto en adwords de preferencia en español', 'Artur is a master of adwords and he is really helpfull. Would work with him again. Thanks :)', 'Google ADS expert for make a campaign today!', 'Good work, is an expert in google ads! Fully recommend!'], 'experience_title': 'Computer Technician - Network Installation and Management', 'experience_time': 'Feb 2018 - Jun 2020 (2 years, 4 months)', 'education_title': 'Work optimization Business', 'education_time': 'N/A', 'description': 'I have a degree in Computer Technician Installation and Network Management.  I am available to help you publicize your business to get more customers and more sales and solve web problems. I am ready to exceed my limits to satisfy every customer.  Google Certified Digital Marketing Expert  Increase your organic traffic and the average position of your keywords with SEO method.  Qualified traffic in Google Adwords, Facebook, Instagram, Linkedin campaigns.  Increase your sales for your company, in ecommerce or physical companies  We place your site on the first page of search engines.  I am a multi-site webmaster, an SEO specialist with a passion for search engines, taking your site or business to the top of Google search, following best practices.    ✅My skills:  *✔️ Google Merchant Center*✔️Facebook Ads*✔️Google Ads*✔️Instagram Ads✔️Pinterest Ads*✔️SEO*✔️WordPress*✔️Website Optimization*✔️eCommerce*✔️ Facebook Marketing**✔️Social Media… Read more', 'profile_skills': {'Internet Marketing': '35', 'Google Adwords': '27', 'Facebook Marketing': '23', 'Marketing': '22', 'Advertising': '20', 'SEO': '14', 'Social Media Marketing': '12', 'Android': '10', 'PHP': '8', 'Mobile App Development': '7', 'Google Adsense': '6', 'Website Design': '6', 'Linux': '5', 'Graphic Design': '5', 'eCommerce': '5', 'Google Analytics': '4', 'Prestashop': '4'}}
3{'name': 'Usman N.', 'username': '@futivetechnet', 'url': 'https://www.freelancer.com/u/futivetechnet', 'title': '3D/2D Design/Animation-SMM-Unity Game Development', 'city': 'Lahore, Pakistan', 'stars_num_reviews': ['@futivetechnet', '4.9', '(139 reviews)'], 'rate': '$25 USD / hour', 'reputation': ['96%', 'Jobs Completed', '96%', 'On Budget', '93%', 'On Time', '12%', 'Repeat Hire Rate'], 'review_ratings': ['5.0', '5.0', '5.0', '5.0', '5.0'], 'review_clean_project_values': ['$12,400.00 USD', '€200.00 EUR', '$150.00 USD', '€4,700.00 EUR', '•'], 'review_project_titles': ['Online Easter crepes hunt game (for kids 5-10)', 'Project for Usman N.', '12 Social media posts for Digital marketing and app development company', 'Mobile game similar to Flappy Bird (side-scroller)', 'Make character animation for 2D game'], "review_project_descriptions'": ['Online Easter crepes hunt game (for kids 5-10)', 'It was a pleasure working with Usman. They made an amazing job!', 'Project for Usman N.', "Great quality of work! It's my second project with Usman, and both were successful. Looking forward to hire him again.", '12 Social media posts for Digital marketing and app development company', 'Usman delivered the posts as per the requirements and he did multiple revisions as per our requirements', 'Mobile game similar to Flappy Bird (side-scroller)', 'Great communication, great project management and great work!', 'Make character animation for 2D game', 'Great work! Usman understands all requirements with minimum clarifications. Result is very good.'], 'experience_title': '3D/2D Design/Animation-SMM-Unity Game Development', 'experience_time': 'Mar 2010 - Present', 'education_title': 'N/A', 'education_time': 'N/A', 'description': 'We are an all in one IT services provider in this region. A team of 70+ skilled & certified professional developers, designers, video editors, 3D modellers & animators, project managers and quality assurance individuals.      Our team is dedicated in providing the work to our clients, meeting the highest quality standards, client specifications & timely delivery of services.      Mobile | PC Games Development:   - Experienced in Unity3D, iOS Swift, Cocos2D, Buildbox, including team for UI/UX designs   - Experienced in Action, Simulation, 2D platformers, multiplayer & arcade games      3D | 2D Works, CGI Graphics:   - 3D Modelling, Rigging, Rendering & Animation   - Expertise in Autodesk Maya, 3DS Max, Blender Studio, DAZ Studio, Adobe Flash & After Effects… Read more', 'profile_skills': {'Animation': '64', '3D Animation': '64', 'Mobile App Development': '53', 'Game Development': '52', 'Graphic Design': '51', 'Game Design': '47', 'Unity 3D': '26', 'Video Services': '26', 'After Effects': '26', '3D Modelling': '24', 'Android': '20', '3D Rendering': '20', 'Photoshop': '18', '3D Design': '15', 'PHP': '14', 'Video Editing': '13', 'Website Design': '13'}}
4# file.txt contains three lines, one for each of the OP's strings
5with open('file.txt') as f:
6    dlist = [ast.literal_eval(s) for s in f.read().splitlines()]
7>>> [len(d) for d in dlist]
8[17, 18, 18]
9

Note that, in the string that you provided, there is a r'\n':

"""...and exactly what i asked for.\nI recommend..."""

So if you try to paste the string surrounded by """ into an interpreter, then that makes ast.literal_eval() choke on the input (as all of a sudden there is a line break in the middle of the string).

If you replace it, then all is well.

1{'name': 'Ravikant P.', 'username': '@exp9993', 'url': 'https://www.freelancer.com/u/exp9993', 'title': 'ASP.NET/ Graphic Design/ Web Design/WordPress/PHP', 'city': 'Indore, India', 'stars_num_reviews': ['@exp9993', '5.0', '(178 reviews)'], 'rate': '$15 USD / hour', 'reputation': ['99%', 'Jobs Completed', '87%', 'On Budget', '94%', 'On Time', '19%', 'Repeat Hire Rate'], 'review_ratings': ['5.0', '5.0', '5.0', '5.0', '5.0'], 'review_clean_project_values': ['€50.00 EUR', '$600.00 USD', '$1,300.00 AUD', '$30.00 USD', '$50.00 USD'], 'review_project_titles': ['Wordpress - Woocommerce Small Function', 'PayDash Frontend', 'Improve current website', 'Project for Ravikant P.', 'Build a page 1:1 copy from Figma design file'], "review_project_descriptions": ['Wordpress - Woocommerce Small Function', 'Very fast and efficient! Made my request in less than 2-3 hours and exactly what i asked for.\nI recommend and will come back for sure! :)', 'PayDash Frontend', 'Delivered a high value project very quickly, always helping me fix any bugs there are in the code. Very great developer and team to work with!', 'Improve current website', 'Amazing job, and nothing was too much trouble. Highly recommend!!', 'Project for Ravikant P.', 'I requested the project from him, he completed it within 30 minutes. Super quick delivery, I will definitely be using him in the future for all of my frontend web development projects.', 'Build a page 1:1 copy from Figma design file', "He did the work very quickly and was super precise about all the little details. He's the perfect person I was looking for, someone who was able to create a page for me while paying attention to all… Read more"], 'experience_title': 'N/A', 'education_title': 'bachelor of engineering', 'education_time': '2011 - 2015', 'description': 'We can make anything you want, if you can describe exactly what you want, will get the exact service until full satisfaction.    My interest lies in designing new material & do believe we are creative & can handle complications, I am always eager to learn new things & by listening carefully & asking the right questions can get to the core of the conversation quickly.        We are a Team of 9+ experienced professionals who work closely with the clients, understand their requirements, offer suggestions, and implement ideas into reality. We always think beyond the boundaries and provide user-friendly as well as high quality IT services to our customers at a very reasonable price. Our team is always dedicative to innovate from high-end E-Commerce website development to the simplest logo design needs… Read more', 'profile_skills': {'Website Design': '138', 'HTML': '129', 'Graphic Design': '115', 'PHP': '99', 'WordPress': '62', 'User Experience Design': '53', 'CSS': '26', 'User Interface / IA': '25', 'Photoshop': '17', 'C# Programming': '13', 'ASP.NET': '12', '.NET': '11', 'eCommerce': '9', 'Microsoft SQL Server': '8', 'Logo Design': '8', 'PSD to HTML': '6', 'WooCommerce': '6'}}
2{'name': 'Artur', 'username': '@Appswebandroid', 'url': 'https://www.freelancer.com/u/Appswebandroid', 'title': '♛Google Certified Digital Marketing - Grow Sales♛', 'city': 'Mafra, Portugal', 'stars_num_reviews': ['@Appswebandroid', '5.0', '(71 reviews)'], 'rate': '$15 USD / hour', 'reputation': ['100%', 'Jobs Completed', '94%', 'On Budget', '97%', 'On Time', '17%', 'Repeat Hire Rate'], 'review_ratings': ['5.0', '5.0', '5.0', '5.0', '5.0'], 'review_clean_project_values': ['$10.00 USD', '$10.00 USD', '$200.00 USD', '$100.00 USD', '$196.00 USD'], 'review_project_titles': ['woodpress seo expert', 'semana adwords', 'Project for Artur', 'experto en adwords de preferencia en español', 'Google ADS expert for make a campaign today!'], "review_project_descriptions'": ['woodpress seo expert', 'Thank you', 'semana adwords', "Artur helped me setup my campaign, but he was also taking care of it during the month that we were working. I couldn't have done it myself. He helped me channel all my money to the right… Read more", 'Project for Artur', 'Great Freelancer, very pro- and reactive. Only recommend. Thank you, Artur!', 'experto en adwords de preferencia en español', 'Artur is a master of adwords and he is really helpfull. Would work with him again. Thanks :)', 'Google ADS expert for make a campaign today!', 'Good work, is an expert in google ads! Fully recommend!'], 'experience_title': 'Computer Technician - Network Installation and Management', 'experience_time': 'Feb 2018 - Jun 2020 (2 years, 4 months)', 'education_title': 'Work optimization Business', 'education_time': 'N/A', 'description': 'I have a degree in Computer Technician Installation and Network Management.  I am available to help you publicize your business to get more customers and more sales and solve web problems. I am ready to exceed my limits to satisfy every customer.  Google Certified Digital Marketing Expert  Increase your organic traffic and the average position of your keywords with SEO method.  Qualified traffic in Google Adwords, Facebook, Instagram, Linkedin campaigns.  Increase your sales for your company, in ecommerce or physical companies  We place your site on the first page of search engines.  I am a multi-site webmaster, an SEO specialist with a passion for search engines, taking your site or business to the top of Google search, following best practices.    ✅My skills:  *✔️ Google Merchant Center*✔️Facebook Ads*✔️Google Ads*✔️Instagram Ads✔️Pinterest Ads*✔️SEO*✔️WordPress*✔️Website Optimization*✔️eCommerce*✔️ Facebook Marketing**✔️Social Media… Read more', 'profile_skills': {'Internet Marketing': '35', 'Google Adwords': '27', 'Facebook Marketing': '23', 'Marketing': '22', 'Advertising': '20', 'SEO': '14', 'Social Media Marketing': '12', 'Android': '10', 'PHP': '8', 'Mobile App Development': '7', 'Google Adsense': '6', 'Website Design': '6', 'Linux': '5', 'Graphic Design': '5', 'eCommerce': '5', 'Google Analytics': '4', 'Prestashop': '4'}}
3{'name': 'Usman N.', 'username': '@futivetechnet', 'url': 'https://www.freelancer.com/u/futivetechnet', 'title': '3D/2D Design/Animation-SMM-Unity Game Development', 'city': 'Lahore, Pakistan', 'stars_num_reviews': ['@futivetechnet', '4.9', '(139 reviews)'], 'rate': '$25 USD / hour', 'reputation': ['96%', 'Jobs Completed', '96%', 'On Budget', '93%', 'On Time', '12%', 'Repeat Hire Rate'], 'review_ratings': ['5.0', '5.0', '5.0', '5.0', '5.0'], 'review_clean_project_values': ['$12,400.00 USD', '€200.00 EUR', '$150.00 USD', '€4,700.00 EUR', '•'], 'review_project_titles': ['Online Easter crepes hunt game (for kids 5-10)', 'Project for Usman N.', '12 Social media posts for Digital marketing and app development company', 'Mobile game similar to Flappy Bird (side-scroller)', 'Make character animation for 2D game'], "review_project_descriptions'": ['Online Easter crepes hunt game (for kids 5-10)', 'It was a pleasure working with Usman. They made an amazing job!', 'Project for Usman N.', "Great quality of work! It's my second project with Usman, and both were successful. Looking forward to hire him again.", '12 Social media posts for Digital marketing and app development company', 'Usman delivered the posts as per the requirements and he did multiple revisions as per our requirements', 'Mobile game similar to Flappy Bird (side-scroller)', 'Great communication, great project management and great work!', 'Make character animation for 2D game', 'Great work! Usman understands all requirements with minimum clarifications. Result is very good.'], 'experience_title': '3D/2D Design/Animation-SMM-Unity Game Development', 'experience_time': 'Mar 2010 - Present', 'education_title': 'N/A', 'education_time': 'N/A', 'description': 'We are an all in one IT services provider in this region. A team of 70+ skilled & certified professional developers, designers, video editors, 3D modellers & animators, project managers and quality assurance individuals.      Our team is dedicated in providing the work to our clients, meeting the highest quality standards, client specifications & timely delivery of services.      Mobile | PC Games Development:   - Experienced in Unity3D, iOS Swift, Cocos2D, Buildbox, including team for UI/UX designs   - Experienced in Action, Simulation, 2D platformers, multiplayer & arcade games      3D | 2D Works, CGI Graphics:   - 3D Modelling, Rigging, Rendering & Animation   - Expertise in Autodesk Maya, 3DS Max, Blender Studio, DAZ Studio, Adobe Flash & After Effects… Read more', 'profile_skills': {'Animation': '64', '3D Animation': '64', 'Mobile App Development': '53', 'Game Development': '52', 'Graphic Design': '51', 'Game Design': '47', 'Unity 3D': '26', 'Video Services': '26', 'After Effects': '26', '3D Modelling': '24', 'Android': '20', '3D Rendering': '20', 'Photoshop': '18', '3D Design': '15', 'PHP': '14', 'Video Editing': '13', 'Website Design': '13'}}
4# file.txt contains three lines, one for each of the OP's strings
5with open('file.txt') as f:
6    dlist = [ast.literal_eval(s) for s in f.read().splitlines()]
7>>> [len(d) for d in dlist]
8[17, 18, 18]
9dct = ast.literal_eval(s.replace('\n', r'\n'))
10>>> len(dct)
1117
12

But this is unnecessary when you read from the file.

Source https://stackoverflow.com/questions/67316632

Community Discussions contain sources that include Stack Exchange Network

Tutorials and Learning Resources in 3D Animation

Tutorials and Learning Resources are not available at this moment for 3D Animation

Share this Page

share link

Get latest updates on 3D Animation