{"id":19224419,"url":"https://github.com/hermann-web/lissajou","last_synced_at":"2025-07-02T13:35:37.265Z","repository":{"id":231447062,"uuid":"780845703","full_name":"Hermann-web/lissajou","owner":"Hermann-web","description":"A Python module for creating animations, including Lissajou curve simulations","archived":false,"fork":false,"pushed_at":"2024-04-07T12:23:36.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-04T21:43:53.902Z","etag":null,"topics":["animation","lissajous","lissajous-curve","lissajous-figures","lissajous-figures-generator","matplotlib-animation","simulation","visualization"],"latest_commit_sha":null,"homepage":"https://lissajou.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Hermann-web.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-02T09:14:15.000Z","updated_at":"2024-04-07T15:30:59.000Z","dependencies_parsed_at":"2024-11-09T15:11:46.744Z","dependency_job_id":"a91f54a3-5701-4154-80ed-3c69402ef636","html_url":"https://github.com/Hermann-web/lissajou","commit_stats":null,"previous_names":["hermann-web/lissajou"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hermann-web%2Flissajou","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hermann-web%2Flissajou/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hermann-web%2Flissajou/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hermann-web%2Flissajou/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hermann-web","download_url":"https://codeload.github.com/Hermann-web/lissajou/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240298487,"owners_count":19779283,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["animation","lissajous","lissajous-curve","lissajous-figures","lissajous-figures-generator","matplotlib-animation","simulation","visualization"],"created_at":"2024-11-09T15:11:38.364Z","updated_at":"2025-02-23T10:16:05.026Z","avatar_url":"https://github.com/Hermann-web.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Lissajou Animation Framework](https://github.com/Hermann-web/lissajou)\n\n## Description\n\nThe Lissajou Animation Framework is a Python module designed for creating diverse animations using matplotlib. It offers a structured approach to building animations, including parametric animations and 3D parametric animations. While the module includes demonstrations of [Lissajou curves](https://en.wikipedia.org/wiki/Lissajous_curve), its primary focus is on providing a framework for general animation creation.\n\n## Installation\n\nYou can install the Lissajou Animation Framework using pip:\n\n```bash\npip install lissajou\n```\n\n## Usage\n\nTo create animations using the framework, you can utilize the provided classes and methods. Here's a basic example to get you started:\n\n```python\nfrom lissajou.anim import GenericLissajou\n\n# Create a GenericLissajou object\nanimation = GenericLissajou()\nanimation.show()\n```\n\n## Classes and Features\n\nThe framework includes the following main classes:\n\n- `BaseAnimation`: An abstract base class for creating animations with setup steps and frame updates.\n- `ImageAnimation`: A subclass of `BaseAnimation` for creating animations with image data.\n- `ParametricAnimation`: A subclass of `BaseAnimation` for creating parametric 2D animations.\n- `ThreeDimensionalParametricAnimation`: A subclass of `ParametricAnimation` for creating parametric 3D animations.\n\n## Showcase\n\nSome Lissajou patterns support have been added to the module. You will find implementations of these animations in the module `lissajou.lissajou` so you can import them, and use with your custom parameters.\n\nFor example\n\n```python\nfrom lissajou.lissajou import SinusoidalAmplitudeLissajou\nliss = SinusoidalAmplitudeLissajou(a=6, delta=np.pi / 6, range=18, nb_points=18000)\nliss.show()\n```\n\nHere are some examples showcasing different types of Lissajou animations:\n\n- Generic Lissajou Curve\n- Lissajou Curve with Varying Amplitude\n- Lissajou Curve with Sinusoidal Amplitude\n- Lissajou Curve with Fixed Ratio\n- Lissajou Ellipse Animation\n- Lissajou Circle Animation\n\nUsage examples an be tested in the file [examples/lissajou_examples.py](./examples/lissajou_examples.py)\n\n## Custom Animation Examples\n\nThe framework allows for creating custom animations beyond the included examples. Here are some demonstrations:\n\n### Image Animation\n\nThis example demonstrates creating an animation with image data.\n\n```python\nclass ImageAnimationExample(ImageAnimation):\n    \"\"\"\n    A subclass of ImageAnimation for creating animations with sinusoidal image data.\n\n    This class generates sinusoidal image data and updates the animation view with\n    the computed sine values for each frame.\n    \"\"\"\n\n    def __init__(self, n):\n        \"\"\"\n        Initializes the SinusoidalImageAnimation object with sinusoidal image data.\n        \"\"\"\n        self.x = np.random.binomial(1, 0.3, size=(n, n))  # Generate random binary image\n        super().__init__()  # Call the superclass constructor to set up the animation\n\n    def _set_params(self, **kwargs):\n        \"\"\"\n        Sets the parameters for the animation, including the shape of the image.\n        \"\"\"\n        kwargs[\"shape\"] = (\n            self.x.shape\n        )  # Set the shape parameter based on the generated image\n        return super()._set_params(\n            **kwargs\n        )  # Call the superclass method to set parameters\n\n    def _before_each_iteration(self, t):\n        \"\"\"\n        Hook method called before each frame iteration.\n        \"\"\"\n        pass  # No pre-iteration setup is needed for this subclass\n\n    def _img_fct(self, t):\n        \"\"\"\n        Computes the image values for each frame using sine function.\n        \"\"\"\n        return np.sin(t * self.x)  # Compute sine values for the current frame\n\n\nif __name__ == \"__main__\":\n    print(\"Example 1: ImageAnimationExample\")\n    liss = ImageAnimationExample(100)\n    liss.show()\n```\n\n### 3D Sinusoidal Parametric Animation\n\nThis example demonstrates creating a 2D or 3D animation using parametric equations with sine functions.\n\n```python\n\nclass ThreeDsinusoidalParametricAnimation(ThreeDimensionalParametricAnimation):\n    \"\"\"\n    A subclass of ThreeDimensionalParametricAnimation for creating 3D sinusoidal parametric animations.\n\n    This class generates parametric data for x, y, and z coordinates using sinusoidal functions.\n    \"\"\"\n\n    def __init__(self, n):\n        \"\"\"\n        Initializes the ThreeDsinusoidalParametricAnimation object.\n        \"\"\"\n        self.n = n\n        super().__init__()  # Call the superclass constructor to set up the animation\n\n    def _before_each_iteration(self, t):\n        \"\"\"\n        Hook method called before each frame iteration.\n        \"\"\"\n        self.tx = np.linspace(-np.pi, np.pi, self.n)  # Generate x values for each frame\n\n    def _fx(self, t):\n        \"\"\"\n        Computes the x-coordinate values for each frame using a sinusoidal function.\n        \"\"\"\n        return np.sin(t * self.tx)  # Generate x values based on the sine of tx\n\n    def _fy(self, t):\n        \"\"\"\n        Computes the y-coordinate values for each frame using a sinusoidal function.\n        \"\"\"\n        return np.cos(t * self.tx)  # Generate y values based on the cosine of tx\n\n    def _fz(self, t):\n        \"\"\"\n        Computes the z-coordinate values for each frame using a hyperbolic tangent function.\n        \"\"\"\n        return np.tanh(\n            t * self.tx\n        )  # Generate z values based on the hyperbolic tangent of tx\n\nif __name__ == \"__main__\":\n    print(\"Example 2: ThreeDsinusoidalParametricAnimation\")\n    liss = ThreeDsinusoidalParametricAnimation(100)\n    liss.show(x_range=(-1, 1), y_range=(-1, 1), z_range=(-1, 1))\n```\n\nYou can also implement a 2D animation in a similar fashion, by using the `ParametricAnimation` abstract class.\n\nThese are just a few examples of how to create custom animations using the Lissajou Animation Framework. Feel free to explore the provided classes and experiment with your own animation ideas!\n\n## Contributing\n\nIf you wish to contribute to the Lissajou Animation Framework, feel free to report issues or submit pull requests on the project's repository.\n\n## License\n\nThis project is distributed under the MIT License.\n\nThis updated README now includes explanations and code examples for custom animation implementations, allowing users to explore the framework's capabilities further.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhermann-web%2Flissajou","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhermann-web%2Flissajou","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhermann-web%2Flissajou/lists"}