{"id":25912902,"url":"https://github.com/vinceglb/ConfettiKit","last_synced_at":"2025-03-03T10:02:50.674Z","repository":{"id":273095678,"uuid":"918687983","full_name":"vinceglb/ConfettiKit","owner":"vinceglb","description":"🎉 A Kotlin/Compose Multiplatform library to add vibrant, customizable confetti animations to your apps.","archived":false,"fork":false,"pushed_at":"2025-02-17T10:00:20.000Z","size":7886,"stargazers_count":20,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-17T11:20:09.740Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://vinceglb.github.io/ConfettiKit/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vinceglb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-01-18T15:45:23.000Z","updated_at":"2025-02-17T10:00:15.000Z","dependencies_parsed_at":"2025-01-18T17:19:28.236Z","dependency_job_id":"4c25453c-a19c-4aeb-84be-17cde9e5ceaa","html_url":"https://github.com/vinceglb/ConfettiKit","commit_stats":null,"previous_names":["vinceglb/confettikit"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinceglb%2FConfettiKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinceglb%2FConfettiKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinceglb%2FConfettiKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinceglb%2FConfettiKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vinceglb","download_url":"https://codeload.github.com/vinceglb/ConfettiKit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241644548,"owners_count":19996178,"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":[],"created_at":"2025-03-03T10:01:46.930Z","updated_at":"2025-03-03T10:02:50.626Z","avatar_url":"https://github.com/vinceglb.png","language":"Kotlin","funding_links":[],"categories":["Kotlin"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/68aed8e6-7e8b-4d5d-925e-7b2641df65f8\" alt=\"ConfettiKit for Kotlin Multiplatform and Compose Multiplatform\" /\u003e\n\n  \u003cbr\u003e\n \n  \u003ch1\u003eConfettiKit\u003c/h1\u003e\n  \u003cp\u003eA lightweight Kotlin/Compose Multiplatform library to add vibrant, customizable confetti animations to your apps.\u003c/p\u003e\n\n  \u003cdiv\u003e\n    \u003cimg src=\"https://img.shields.io/maven-central/v/io.github.vinceglb/confettikit\" alt=\"ConfettiKit Kotlin Maven Version\" /\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Platform-Android-brightgreen.svg?logo=android\" alt=\"Badge Android\" /\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Platform-iOS-lightgrey.svg?logo=apple\" alt=\"Badge iOS\" /\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Platform-JVM-8A2BE2.svg?logo=openjdk\" alt=\"Badge JVM\" /\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Platform-WASM%20%2F%20JS-yellow.svg?logo=javascript\" alt=\"Badge WASM / JS\" /\u003e\n  \u003c/div\u003e\n\n  \u003cp align=\"center\"\u003e\n    \u003ca href=\"#-installation\"\u003eInstallation\u003c/a\u003e •\n    \u003ca href=\"#-creating-your-first-celebration\"\u003eQuick start\u003c/a\u003e •\n    \u003ca href=\"#-customizing-your-celebration\"\u003eDocumentation\u003c/a\u003e •\n    \u003ca href=\"#-recipes\"\u003eRecipes\u003c/a\u003e •\n    \u003ca href=\"https://github.com/vinceglb/ConfettiKit/tree/main/sample\"\u003eSample project\u003c/a\u003e\n  \u003c/p\u003e\n\n  \u003ca href=\"https://vinceglb.github.io/ConfettiKit/\"\u003eTry here 🥳\u003c/a\u003e\n\n  \u003cbr\u003e\n\u003c/div\u003e\n\n## 😎 Credits\n\n\u003e This library is based on the incredible work of [@DanielMartinus](https://github.com/DanielMartinus) on his Android [Konfetti](https://github.com/DanielMartinus/Konfetti) library and has been adapted for Kotlin Multiplatform and Compose Multiplatform.\n\n## 📦 Installation\n\n```kotlin\ndependencies {\n    implementation(\"io.github.vinceglb:confettikit:0.1.0\")\n}\n```\n\n## ✨ Creating Your First Celebration\n\nThe simplest way to get the party started is:\n\n```kotlin\nConfettiKit(\n    modifier = Modifier.fillMaxSize(),\n    parties = listOf(\n        Party(emitter = Emitter(duration = 5.seconds).perSecond(30))\n    )\n)\n```\n\nThat's it! You've got confetti! 🎊\n\n## 🎉 Customizing Your Celebration\n\nA Party configuration object controls every aspect of your confetti animation. While you only need an Emitter to get started, understanding each property helps you create exactly the effect you want.\n\n### 🚀 Motion and Direction\n\n#### 🎯 Controlling the Launch\n\n```kotlin\nParty(\n    angle = 90,    // Straight up\n    spread = 45,   // 45-degree spread\n)\n```\n\nThe direction and spread of your confetti is controlled by several properties:\n\n**`angle`**\n- Think of this as the direction your confetti launcher is pointing\n- 0° points right, 90° points up, 180° points left, 270° points down\n- Use convenient presets like `Angle.TOP`, `Angle.RIGHT`, `Angle.BOTTOM`, `Angle.LEFT`\n- Example: angle = 45 launches confetti diagonally up and right\n\n**`spread`**\n- Controls how wide your confetti spray pattern is\n- Think of it like adjusting a garden sprayer nozzle\n- 360° creates a full circular burst\n- 1° creates a focused line\n- Use convenient presets like `Spread.SMALL`, `Spread.WIDE` and `Spread.ROUND`\n- Example: spread = 90 creates a quarter-circle spray pattern\n\n#### 🏃‍♂️ Velocity Control\n\n```kotlin\nParty(\n    speed = 20f,      // Base speed\n    maxSpeed = 30f,   // Maximum speed\n    damping = 0.95f   // Speed decay\n)\n```\n\nControl how fast your confetti moves and how it slows down:\n\n**`speed`**\n- The initial velocity of each confetti piece\n- Higher values make confetti shoot out faster\n\n**`maxSpeed`**\n- Creates natural variation by randomly picking speeds between `speed` and `maxSpeed`\n- Set to -1 to disable the upper limit\n- Example: speed = 20f, maxSpeed = 30f means each piece will have a random speed between 20 and 30\n\n**`damping`**\n- Controls how quickly confetti slows down\n- Values closer to 1 make confetti float longer\n- Lower values make it slow down faster\n- Example: damping = 0.98f creates a floating effect\n\n### 🎨 Visual Customization\n\n```kotlin\nParty(\n    colors = listOf(0xfce18a, 0xff726d, 0xf4306d),\n    shapes = listOf(Shape.Square, Shape.Circle),\n    size = listOf(Size.SMALL, Size.MEDIUM)\n)\n```\n\nCustomize how your confetti looks:\n\n**`colors`**\n- List of colors randomly chosen for each piece\n- Use your brand colors or theme colors\n- Example: colors = listOf(0xFF0000, 0x00FF00) for red and green confetti\n\n**`shapes`**\n- Define what shapes your confetti can be\n- Use `Shape.Circle`, `Shape.Square` and `Shape.Rectangle()`\n- Example: shapes = listOf(Shape.Circle) for circular confetti only\n\n**`sizes`**\n- Control how big your confetti pieces are\n- Mix different sizes for more dynamic effects\n- Use convenient presets like `Size.SMALL`, `Size.MEDIUM` and `Size.LARGE`\n- Example: size = listOf(Size.SMALL) for subtle, delicate confetti\n\n### ⚡ Animation Lifecycle \n\n```kotlin\nParty(\n    timeToLive = 3000,       // 3 seconds lifetime\n    fadeOutEnabled = true,   // Fade out at end\n    delay = 500,             // Start after 500ms\n    position = Position.Relative(0.5, 0.5),\n    rotation = Rotation.enabled()\n)\n```\n\nControl the timing and behavior of your confetti:\n\n**`timeToLive`**\n- How long each piece of confetti exists (in milliseconds)\n- Longer times create more overlapping particles\n- Example: timeToLive = 5000 makes confetti last for 5 seconds\n\n**`fadeOutEnabled`**\n- When true, confetti fades out at the end of its life\n- When false, it disappears instantly\n- Example: fadeOutEnabled = false for sharp disappearance\n\n**`delay`**\n- How long to wait before starting the animation (in milliseconds)\n- Use this to create a delay before the confetti starts\n- Example: delay = 1000 starts confetti 1 second after the view appears\n\n**`position`**\n- Where confetti spawns from\n- Use Position.Absolute(x, y) for exact screen coordinates\n- Use Position.Relative(x, y) for responsive positioning (0.0 to 1.0)\n- Use Position.Between(min, max) for random positions between two points\n- Example: position = Position.Relative(0.5, 0.0) spawns from top center\n\n**`rotation`**\n- Control whether confetti rotates as it falls\n- Use `Rotation.enabled()` to enable rotation\n- Use `Rotation.disabled()` to disable rotation\n\n### 🌟 Emission Control \n\nThe Emitter controls how many pieces of confetti are created and how often:\n\n```kotlin\n// Burst of 100 pieces over 100ms\nEmitter(duration = 100, TimeUnit.MILLISECONDS).max(100)\n\n// Continuous stream of 30 pieces per second for 5 seconds\nEmitter(duration = 5, TimeUnit.SECONDS).perSecond(30)\n```\n\n## 📱 Using in Compose\n\nConfettiKit is designed to work seamlessly with Compose. You can use it as a Composable function in your UI:\n\n```kotlin\nConfettiKit(\n    modifier = Modifier.fillMaxSize(),\n    parties = parties,\n    onParticleSystemEnded = { system, activeSystems -\u003e }\n)\n```\n\n## 🧑‍🍳 Recipes\n\n### 💥 Explode\n\nCreate a burst of confetti that explodes from a single point:\n\n```kotlin\nfun explode(): List\u003cParty\u003e {\n    return listOf(\n        Party(\n            speed = 0f,\n            maxSpeed = 30f,\n            damping = 0.9f,\n            spread = 360,\n            colors = listOf(0xfce18a, 0xff726d, 0xf4306d, 0xb48def),\n            emitter = Emitter(duration = 100.milliseconds).max(100),\n        )\n    )\n}\n```\n\n### 🎊 Parade\n\nCreate a parade of confetti that moves from one side of the screen to the other:\n\n```kotlin\nfun parade(): List\u003cParty\u003e {\n    val party = Party(\n        speed = 10f,\n        maxSpeed = 30f,\n        damping = 0.9f,\n        angle = Angle.RIGHT - 45,\n        spread = Spread.SMALL,\n        colors = listOf(0xfce18a, 0xff726d, 0xf4306d, 0xb48def),\n        emitter = Emitter(duration = 5.seconds).perSecond(30),\n        position = Position.Relative(0.0, 0.5)\n    )\n\n    return listOf(\n        party,\n        party.copy(\n            angle = party.angle - 90, // flip angle from right to left\n            position = Position.Relative(1.0, 0.5)\n        ),\n    )\n}\n```\n\n### 🌧️ Rain\n\nCreate a gentle rain of confetti that falls from the top of the screen:\n\n```kotlin\nfun rain(): List\u003cParty\u003e {\n    return listOf(\n        Party(\n            speed = 0f,\n            maxSpeed = 15f,\n            damping = 0.9f,\n            angle = Angle.BOTTOM,\n            spread = Spread.ROUND,\n            colors = listOf(0xfce18a, 0xff726d, 0xf4306d, 0xb48def),\n            emitter = Emitter(duration = 3.5.seconds).perSecond(100),\n            position = Position.Relative(0.0, 0.0).between(Position.Relative(1.0, 0.0))\n        )\n    )\n}\n```\n\n## 🌱 Sample project\n\nCheck out the [sample project](https://github.com/vinceglb/ConfettiKit/tree/main/sample) for a complete example of how to use ConfettiKit in your app.\n\n---\n\nMade with ❤️ by Vince\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinceglb%2FConfettiKit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvinceglb%2FConfettiKit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinceglb%2FConfettiKit/lists"}