HypnoticCanvas
April 26, 2025 · View on GitHub
HypnoticCanvas
Note
This README is under construction.
HypnoticCanvas is a library providing a convenient Modifier offering mesmerising shaders as
background in your Compose based UI.
https://github.com/mikepenz/HypnoticCanvas/assets/1476232/ee120f1c-d18a-43c4-a7bc-a2d245e01482
Setup
Core-module
implementation "com.mikepenz.hypnoticcanvas:hypnoticcanvas:${version}"
Note
All shaders provided in the core module are licensed either under MIT or Apache 2.0 license.
Shader-module
implementation "com.mikepenz.hypnoticcanvas:hypnoticcanvas-shaders:${version}"
Important
Shaders in this module have non permissive licenses. Ensure to read the
LICENSE
section of the README.
Usage
Box(
modifier = Modifier
.fillMaxSize()
.shaderBackground(BlackCherryCosmos)
)
// Usage of Shader with configurations
Box(
modifier = Modifier
.fillMaxSize()
.shaderBackground(
MeshGradient(
arrayOf(Color(0xFFFF15E5), Color(0xFFFAAEF7), Color(0xFF6903F9)),
scale = 1f
)
)
)
Compatiblity
HypnoticCanvas is built with Compose Multiplatform, meaning that it supports different platforms:
| Platform | Supported | Link |
|---|---|---|
| Android | ✅ (A13+) | |
| Desktop (JVM) | ✅ | |
| iOS | ✅ | |
| Wasm | ✅ | Sample |
Build & Run Sample App
Run Desktop App
./gradlew sample:run
Run Web App
./gradlew sample:wasmJsRun
Update aboutLibraries.json
./gradlew sample:exportLibraryDefinitions -PaboutLibraries.exportPath=src/commonMain/composeResources/files/
Credit
The base project setup is strongly based on the haze project by Chris Banes, Licensed under Apache License 2.0
The individual shaders are based on the respective shaders licenses. More details below.
Shaders core-module
| Name | Author | License | Note |
|---|---|---|---|
| MeshGradient | Mike Penz | MIT License | |
| MesmerizingLens | Mike Penz | MIT License | |
| GlossyGradients | Giorgi Azmaipharashvili | MIT License | Rights bought for this shader on Fiverr, included in this project under MIT. |
Shaders shaders-module
| Name | Author | License | Note |
|---|---|---|---|
| BlackCherryCosmos2 via via | axiomcrux | CC BY-NC-SA 3.0 DEED | Shader does not specifically include license, however found the shader it appears to be based on. |
| GoldenMagma | TAKUSAKU | CC BY-NC-SA 3.0 DEED | |
| IceReflection | TAKUSAKU | CC BY-NC-SA 3.0 DEED | |
| InkFlow | TAKUSAKU | CC BY-NC-SA 3.0 DEED | |
| OilFlow | TAKUSAKU | CC BY-NC-SA 3.0 DEED | |
| PurpleLiquid | fouad | CC BY-NC-SA 3.0 DEED | |
| RainbowWater | flylo | CC BY-NC-SA 3.0 DEED | |
| Stage | TAKUSAKU | CC BY-NC-SA 3.0 DEED |
License
The core project code in this repository is licensed as under Apache
2.0. SPDX-License-Identifier: Apache-2.0.
All Shaders are provided under their respective Authors license.
Shaders in the hypnoticcanvas module are licensed either as MIT, or Apache 2.0.
Shaders in the hypnoticcanvas-shaders module are licensed
as SPDX-License-Identifier: CC-BY-NC-SA-3.0.
Core module License
The source code for the core module is licensed under Apache 2.0, with the shaders provided in the core module as MIT License.
Copyright 2025 Mike Penz
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Shaders module License
Shaders in this module are most from ShaderToy.com and are licensed Attribution-NonCommercial-ShareAlike 3.0 Unported. Which is the default license as outlined by ShaderToy.com