当前位置:网站首页>An animation based button animation combined with basic code
An animation based button animation combined with basic code
2022-08-03 13:13:00 【The rain wing light dust】

文章目录
The previous section covered the basic use of buttons,This section talks about the use in conjunction with the base code.
一、新建按钮
(1)画一个矩形
用【矩形工具】画一个圆角矩形.(Change the round angle to 80)
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ZtANaru9-1659313395233)(D:\Typora图片\image-20220731191239419.png)]](/img/57/e0d892bd0c32b0604ad63f1b5338fa.png)
(2)Convert to button
Place the rectangle you just made,选中.
按F8转化为元件,类型为“按钮”.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-U4a7nO0r-1659313395237)(D:\Typora图片\image-20220731191355120.png)]](/img/86/b53659adbf90e9ee1e0413811f4cc0.png)
二、指向
(1)Build components internally
Double click the enter button.
“弹起”when it is blue.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-pBzffrkx-1659313395239)(D:\Typora图片\image-20220731191528431.png)]](/img/96/7f86f88de18761039db1d99dc62d61.png)
在“指向”的位置,按F6Convert to keyframes.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-OeLtvatt-1659313395239)(D:\Typora图片\image-20220731191711798.png)]](/img/d4/7e5c9d924f10b06da44c2aec370bc2.png)
再次选中,F8转化为元件,类型改为“影片剪辑”.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-7bgVDGpx-1659313395240)(D:\Typora图片\image-20220731191834409.png)]](/img/6c/908b5b921f736d2efb2e0de9aeb204.png)
(2)创建关键帧
然后双击进入.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-uxq1CWPY-1659313395240)(D:\Typora图片\image-20220731191939306.png)]](/img/ab/c33d6aeaf4673428e6a8e74bf32a69.png)
在第5帧和第20The position of the frame creates keyframes.(快捷键F6)
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-OODaznpe-1659313395241)(D:\Typora图片\image-20220731192201333.png)]](/img/b4/fef0f67968e181bffcfd6eb5949dc7.png)
(3)改变颜色
在第20帧的位置,Change its color to green.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-KLYV3XSk-1659313395242)(D:\Typora图片\image-20220731192451405.png)]](/img/ba/f8f64114c049612fa88059c88c2a88.png)
(4)创建补间形状
将第5帧到第20帧中间,右键“创建补间形状”.
这样的话,第5帧到第20The frame color is the transition.(From blue to green)
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-0yshURGf-1659313395242)(D:\Typora图片\image-20220731192629068.png)]](/img/3e/18acbf43e1b0c060ecc1a95c4f1d4d.png)
三、点击
(1)创建关键帧
First exit the current component and return to it“按钮”.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-yLiP6RqY-1659313395242)(D:\Typora图片\image-20220731193020495.png)]](/img/96/919fad3079c5001b171cb020630754.png)
在“按下”的地方,按F6Convert to keyframes.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-NvzOu1YD-1659313395244)(D:\Typora图片\image-20220731193105757.png)]](/img/fa/3791ef22165da943bd5b165b55d1a2.png)
(2)换颜色
Just now we did“指向”is a movie clip.
那么,现在还是“影片剪辑”.
我们要Ctrl+B打散,Change it to yellow.

(3)目前效果
Go out and go back first“场景1”.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-rqWjW5p3-1659313395244)(D:\Typora图片\image-20220731193629059.png)]](/img/55/de973248f97a77f92ae589e78d0e97.png)
然后Ctrl+Enter查看效果.(Only the mouseover button color change is demonstrated here,Click the button and it will turn yellow,No demo just,I'm afraid everyone will be confused)

(4)更改代码
可以看到,上边,when the mouse is placed(指向),The button color keeps flashing.
How can it not flash?
First double-click the rectangle to enter“按钮”.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-7WnbxVpR-1659313395245)(D:\Typora图片\image-20220731194039188.png)]](/img/1f/801ee5e867ac8fcc826a86175a9dbf.png)
点击一下“指向”关键帧.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-saHCfpAI-1659313395245)(D:\Typora图片\image-20220731194127693.png)]](/img/da/ce852dfaaaa8cad85f7d7a37c6e167.png)
Then double click to enter“矩形(内)”.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-da3QnNvc-1659313395246)(D:\Typora图片\image-20220731194201658.png)]](/img/ee/bb04cd5eeb0e14e431dabbbfcf1511.png)
按下快捷键F9,打开代码.
点击这个小箭头,然后点击“AS”.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-IRK9oXv3-1659313395246)(D:\Typora图片\image-20220731194332481.png)]](/img/b2/32038e996e40ef5c2a068ce1bce2a8.png)
双击文件“Stop at this frame”.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-MuYhPzfk-1659313395246)(D:\Typora图片\image-20220731194438647.png)]](/img/45/bde900c59a6fdf9f76b80f92e9e7e5.png)
There will be code here.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-alLVLoRa-1659313395246)(D:\Typora图片\image-20220731194607701.png)]](/img/02/2363400774246b6bdbc662df7a89d9.png)
(5)效果
Then we fork these off,Click out to go back“场景1”.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-PGMWCENW-1659313395247)(D:\Typora图片\image-20220731194659974.png)]](/img/0f/a4626077a56a016148cdb157999ab0.png)
然后ctrl+Enter看一下效果.
可以看到,当鼠标放上去的时候,按钮颜色(from blue to green)change naturally,It didn't jump.
四、小案例
Do a mouse click here,A small case of image rotation.
(1)Insert the first sheet
在第1Frame insert bunny picture.(Resize the picture to fit the stage)
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-PUZ22MTU-1659313395247)(D:\Typora图片\image-20220731195905831.png)]](/img/d0/24824b89150c6a0b27c5ae0a4947f2.png)
(2)Insert the second sheet
在第2帧按F7插入“空白关键帧”.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-GWM7miJg-1659313395247)(D:\Typora图片\image-20220731200017473.png)]](/img/6f/8d95a41413b1848a4878a3878f967f.png)
Then drag the squirrel picture into it.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-vgnzk3zv-1659313395248)(D:\Typora图片\image-20220731200531908.png)]](/img/22/a474de3dbef0f08d16f0c8bc56c3ec.png)
(3)Insert the third sheet
在第3帧按F7插入“空白关键帧”.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ClJo2hKT-1659313395248)(D:\Typora图片\image-20220731213957089.png)]](/img/ce/85e330d3d0b1f3560e500dd133e781.png)
Then drag in the kitten picture.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-pvyfEK5O-1659313395249)(D:\Typora图片\image-20220731214052444.png)]](/img/1f/66ff030e46474f70438cd51666b894.png)
(4)创建按钮
新建一个图层.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-94ySi4Ci-1659313395249)(D:\Typora图片\image-20220731214229325.png)]](/img/46/4416e45b22a0f85fe1e950707a166b.png)
在第1帧的位置,画一个矩形,Cover the stage.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-wDIgy3ZC-1659313395249)(D:\Typora图片\image-20220731214301677.png)]](/img/e8/b7b2806a04b9cdc1ad0ebbd8a5100a.png)
Then convert this rectangle into a component,类型为“按钮”.(按F8)
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ISc24vEm-1659313395250)(D:\Typora图片\image-20220731214419164.png)]](/img/51/544ce83a03f9fc5bb0a1fa2839d18b.png)
降低Alpha值,Make it a transparent button.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-034euyy9-1659313395250)(D:\Typora图片\image-20220731214538500.png)]](/img/e4/6270f37e5d0002b560be31ce12e24a.png)
(5)Click to stop at the next frame
Press on the first frameF9打开代码,双击文件“Click to go to the next frame and stop”.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-rAvShQ0j-1659313395255)(D:\Typora图片\image-20220731214732720.png)]](/img/a7/244cf0a9e371c30e2203ddac1fbe03.png)
点击“确定”.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-nUW4ZhWf-1659313395256)(D:\Typora图片\image-20220731214845521.png)]](/img/e1/a348b7350dd58ff63155ff782f3c4d.png)
The code is there.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-VVsen3Gd-1659313395256)(D:\Typora图片\image-20220731214924830.png)]](/img/f7/b4ed48c168671399337676ee1781fc.png)
Then turn them off.
看一下效果:
图片太大,无法显示,跳转查看.
(6)Stop at this frame
哎呀,keep jumping.
我们继续在第1帧按F9call out code.
双击文件“Stop at this frame”.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-svqr88My-1659313395257)(D:\Typora图片\image-20220731215607252.png)]](/img/74/39905041c7c51ab41f20fa59622fe6.png)
The code is automatically filled in.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-qgbK7t7t-1659313395258)(D:\Typora图片\image-20220731215648530.png)]](/img/2f/28cec8db3dfbff15fbe3d854d5a984.png)
Then fork them off,看一下效果:(点击一次,Go to the next image)
(7)返回到第一帧
The effect just now,is a single click,Just go to the next picture.
to the last picture,Just don't move.
Now I want to click on the last image,转到第一张.
on layer two,Press the third frameF9.
然后双击文件“Click to go to frame and stop”.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-NQrkywYz-1659313395258)(D:\Typora图片\image-20220731221140071.png)]](/img/3e/6e353e0fedbe4d0257e9ae782ec06d.png)
We want to start with the last one,转移到第1帧,So this place changed to1.
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-M0fme1Ea-1659313395259)(D:\Typora图片\image-20220731221329659.png)]](/img/36/5b02020b709240bb2798772ff7616f.png)
After fork off,看一下效果:

希望文章对你有帮助,原创不易,多多支持~
边栏推荐
- Basic principle of the bulk of the animation and shape the An animation tip point
- An工具介绍之3D工具
- An animation optimization of shape tween and optimization of traditional tweening
- 实数取整写入文件(C语言文件篇)
- 【Verilog】HDLBits题解——验证:阅读模拟
- 数据库基础知识一(MySQL)[通俗易懂]
- 可视化图表设计Cookbook
- Unsupervised learning KMeans notes and examples
- setTimeout, setInterval requestAnimationFrame
- From the physical level of the device to the circuit level
猜你喜欢

什么是分布式锁?几种分布式锁分别是怎么实现的?

Jmeter使用

An introduction to basic tools for selecting line tools (package church)

Sogou news - dataset

An introduction to 3D tools

欧曼自动挡、银河大马力、行星新产品 欧曼全新产品以燎原之势赢领市场

How to build an overseas purchasing system/purchasing website - source code analysis

An工具介绍之摄像头

Station B responded that "HR said that core users are all Loser": the interviewer was persuaded to quit at the end of last year and will learn lessons to strengthen management

【R】用grafify搞定统计绘图、方差分析、干预比较等!
随机推荐
An动画基础之元件的图形动画与按钮动画
An工具介绍之形状工具及渐变变形工具
Feature dimensionality reduction study notes (pca and lda) (1)
Yahoo! Answers-数据集
VLAN 实验
图像融合DDcGAN学习笔记
技术分享 | 接口自动化测试如何搞定 json 响应断言?
【Verilog】HDLBits题解——验证:阅读模拟
PyTorch框架训练线性回归模型(CPU与GPU环境)
AMS simulation
When Nodejs installation depends on cpnm, the install shows Error: Cannot find module 'fs/promises'
GameFi industry down but not out | June Report
[R] Use grafify for statistical plotting, ANOVA, intervention comparisons, and more!
(through page) ali time to upload the jar
An基本工具介绍之选择线条工具(包教会)
An introduction to the skeleton tool
如何让history历史记录前带时间戳
Nodejs 安装依赖cpnm时,install 出现Error: Cannot find module ‘fs/promises‘
图像融合SDDGAN文章学习
HCIP第十五天笔记(企业网的三层架构、VLAN以及VLAN 的配置)