美文网首页
Spiral - Enjoy Drawing

Spiral - Enjoy Drawing

作者: BiggerMax | 来源:发表于2018-08-24 14:17 被阅读0次

Welcome to the spiral world, where you can adjust the density, color, layer of the spiral, draw the spiral that belongs to you, save it to your phone and share it with your friends.

Code:

funcplayAnimation() {

        let times = showingHistoryRecords.map { $0.duration }

        showingHistoryRecords.enumerated().forEach{ (index, item)in

            item.layers.forEach({ (layer)in

                varanimation:CABasicAnimation!

                ifitem.penStyle== .pencil{

                    layer.strokeEnd=0;

                    animation =CABasicAnimation.init(keyPath:"strokeEnd")

                }else{

                    layer.opacity=0;

                    animation =CABasicAnimation.init(keyPath:"opacity")

                }

                animation.duration= item.duration

                animation.fromValue=0;

                animation.toValue=1

                animation.beginTime=CACurrentMediaTime() + times.enumerated().reduce(0.0, { (result, arg1) ->Doublein

                    ifarg1.0>= index {

                        returnresult

                    }else{

                        returnresult + arg1.1

                    }

                });

                animation.isRemovedOnCompletion=false

                animation.fillMode=kCAFillModeForwards

                layer.add(animation, forKey:"animation");

            })

        }

    }

相关文章

  • Spiral - Enjoy Drawing

    Welcome to the spiral world, where you can adjust the den...

  • 54. Spiral Matrix

    54. Spiral Matrix 题目:https://leetcode.com/problems/spiral...

  • UIView相关

    Drawing Cycle The UIView class uses an on-demand drawing ...

  • Enjoy

    Enjoy reading.Enjoy writing.Enjoy learning.Enjoy thinking...

  • canvas绘图

    1.基本用法 A drawing of something var drawing = document.getE...

  • Drawing

    好久没有画了,今天是我的阳历生日,20岁加油!!!

  • Drawing

    I spent more than 3 hours on drawing Why did not I do som...

  • Drawing

    DAY.4 这个是临摹简书上的,觉得很可爱,把它剪下来贴到黑色纸的本子上超级喜欢啊,回头再多画些,这些简单的图案让...

  • Drawing

    DAY.6 第一次用针管笔描边,果然蛮爽哒 棒棒糖有点吃藕哈哈 周六,你说,如果什么事情都没有,就听着歌然后画两笔...

  • Drawing

网友评论

      本文标题:Spiral - Enjoy Drawing

      本文链接:https://www.haomeiwen.com/subject/kjibiftx.html