APP清理垃圾动画-Framer实现

用户头像
杭州/UI设计师/10年前/1042浏览
APP清理垃圾动画-Framer实现
用户头像
exnaet

APP清理垃圾动画,尝试用Framer实现效果,源代码贴出来和sketch文件在附件中,大家相互交流学习。本来想发到作品里面的,作品里面只能上传图片。不能贴源码。好在注释比较详细!

APP清理垃圾动画,尝试用Framer实现效果,源代码贴出来和sketch文件在附件中,大家相互交流学习。本来想发到作品里面的,作品里面只能上传图片。不能贴源码。好在注释比较详细!9982577c662c0000018c1beb8e72.jpg


# 导入sketch文件

clean = Framer.Importer.load("imported/clean@1x")

#直接用图层名引用对象

Utils.globalLayers clean

#点击效果刚开始不显示

press.opacity = 0

#清理完成刚开始不显示

over.opacity = 0

#给立即清理添加状态

go.states.add

    default:

        opacity: 1

    upload:

        opacity: 0

#这里要实现进度条的旋转必须新建一个图层在外面包住旋转图形,大小请参考sketch文件

xzbg =new Layer

    width: 578

    height: 578

    y: 202

    backgroundColor: null

xzbg.centerX();

#设置旋转对象的父元素为隐藏图层

wei.superLayer = xzbg

wei.x = 50

wei.y = 0


#实现百分比图层样式

bfb = new Layer

    y: 480

    width: 300

    height: 130

    opacity: 0

    backgroundColor: null

bfb.centerX()

bfb.style = 

    "font-size" : "122px"

    "color" : "#FFF"

    "text-align" : "center"

bfb.html = 0

#设置隐藏图层在pass背景图层上面

xzbg.placeBefore pass

#给立即清理添加状态

over.states.add

    default:

        opacity:1

    upload:

        opacity:0

#实现旋转动画状态

xzbg.states.add

    default:

        rotation: 360

    upload:

        rotation: 0

#设置旋转动画属性

xzbg.states.animationOptions = 

    repeat: 1

    curve: "linear"

    time: 1

#监听旋转,根据旋转的度数获取百分数值,然后把百分数值赋值给百分比图层

xzbg.on "change:rotation", ->

    percentage = Utils.modulate xzbg.rotation, [0,360], [0, 100]

    bfb.html = (Utils.round percentage, 0) + "%"


jindu.visible = false

#定义APP数组

app = [ "微信" , "QQ" , "印象笔记" , "网易云音乐" , "喜马拉雅FM" , "微桌面" ]



#点击事件添加状态

press.states.add

    default:

        opacity: 1

    upload01:

        opacity: 0

#点击事件添加动画状态

press.states.animationOptions = 

    time: .1

#点击事件

xzbg.on Events.Click, ->

    #显示百分比

    bfb.opacity = 1

    #隐藏立即清理

    go.opacity = 0

    #播放动画时隐藏清理完毕

    over.states.switchInstant "upload"

    #显示蓝色背景

    press.states.switch "default"

    #开始旋转

    xzbg.states.switch "default"

    #开始循环

    for [1..20]

        #从app数组中随机抽取一个

        color = Utils.randomChoice app

        #新建承载图层

        text01 = new Layer

            width: 300 , height: 80

            html: "#{color}"

            backgroundColor: null

            x: Utils.randomNumber +100, Screen.width - 420

            y: 580

            style: "font-size" : "48px","color" : "#666","text-align" : "center","line-height" : "72px"

        #给承载图层添加动画

        text01.animate

            properties:

                y: Screen.height - 100

                x: Screen.width/2-150

                scaleX: .2

                scaleY: .2

                opacity: 0

            time: Utils.randomNumber 1.5, 2.5

            delay: Utils.randomNumber 0, 2

            curve: "ease-in"

        text01.placeBehind pass

        text01.on Events.AnimationEnd, ->

            #已经用完,及时销毁

            this.destroy()


#恢复到初始状态

xzbg.on Events.AnimationEnd,->

    press.states.switch "upload01"

    xzbg.states.switchInstant("upload")

    bfb.opacity = 0

    over.states.switch "default"


6
举报
|
7
分享
评论
用户头像
评论你的想法~
表情
喜欢TA的作品吗?喜欢就快来夸夸TA吧!
推荐素材
【新年UI图标】汽车icon
【新年UI图标】礼物/活动icon
【新年UI图标】钱包icon
盲盒APP UI设计
新拟态风格 UI设计组件库
3D卡通UI界面图标可爱插画免扣素
原创UIUX交互橙红渐变炫酷视觉平面设计作品集模板PSD
Security Camera UI kit
【新年UI图标】体育icon
【新年UI图标】秒杀icon
【新年UI图标】旅行icon
【新年UI图标】会员icon
我的钱包-UI界面设计-app
高级表盘系列UI源文件
UI 登录界面设计模板包
拟物风质感写实UI卡片合集源文件
手表表盘UI系列
智能家居中心 简约 UI设计组件库
新能源APP应用UIKit
UI界面 组件
UI通用设计素材1
高级感金属拟物 UI设计组件库
【新年UI图标】30个图标
你可能喜欢
大家都在看
登录注册