如何通过雪花动画形成位图

时间:2019-04-17 17:25:13

标签: android kotlin bitmap led

我正在制作一个与LED徽章集成的应用程序,因此我希望我的可绘制对象通过雪花动画构建。我在构建它时遇到了一些问题。

我已经尝试过:

val line = badgeWidth - animationIndex.div(400).rem(badgeWidth)

                        if (lastFrame != line)
                            countFrame += 1
                        lastFrame = line

                        if (!matchFrame)
                            matchFrame = checkList[i].list[lastFrame + badgeWidth / 2]

                        val checkLineOnRow = when {
                            countFrame < (badgeWidth + 1) -> matchFrame && j >= lastFrame
                            countFrame > (2 * badgeWidth) -> matchFrame && j <= lastFrame
                            else -> false
                        }

                        val checkBitmapOnRow = when {
                            countFrame < (badgeWidth + 1) -> j < lastFrame
                            countFrame > (2 * badgeWidth) -> j > lastFrame
                            else -> true
                        }

                        if (checkLineOnRow || validMarquee || flashLEDOn &&
                            i < checkList.size &&
                            j < checkList[i].list.size &&
                            checkBitmapOnRow &&
                            checkList[i].list[j + badgeWidth / 2]) {
                            ledEnabled.bounds = cells[i].list[j]
                            ledEnabled.draw(canvas)
                        } else {
                            ledDisabled.bounds = cells[i].list[j]
                            ledDisabled.draw(canvas)
                        }

                        if (countFrame > (3 * (badgeWidth))) {
                            countFrame = 0
                            lastFrame = 0
                        }

我希望在位从led预览的顶部掉落时构建drawable

0 个答案:

没有答案