keyframe 动画

本文以实例介绍了实现一个 JS keyframe 动画需要进行的操作。

本文以实现线上支付效果页点击动画为例,介绍动画的实现过程。

  1. 引入 Animation 模块,且必须在 export default 外面引入(第 19 行)。

  2. 定义 keyframe 的具体动画效果(第 21 行)。

  3. 加载动画。调用 animation 的 loadkeyframe 可夹在定义的动画内容(第 135 行)。

  4. 给节点指定已加载的动画(第 159 行)。该示例是动态指定节点的 keyframe 动画,也可以将 animation 的相关属性直接写在节点的 class 中。

  5. keyframe 动画中的 animation 属性支持请参考 动画

示例代码如下:

<template>
    <div class="card_root">
        <div class="white_bg"  @click="clickAnimation()">
            <div class = "right_content_div"> 
                    <text value="点击悬浮水滴执行动画"></text>              
                    <div class="image_tip">
                        <image class="image_tip_icon" :style="imageTipeAnimationStyle" resize="cover" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABVCAYAAADe3GMeAAABYWlDQ1BrQ0dDb2xvclNwYWNlRGlzcGxheVAzAAAokWNgYFJJLCjIYWFgYMjNKykKcndSiIiMUmB/yMAOhLwMYgwKicnFBY4BAT5AJQwwGhV8u8bACKIv64LMOiU1tUm1XsDXYqbw1YuvRJsw1aMArpTU4mQg/QeIU5MLikoYGBhTgGzl8pICELsDyBYpAjoKyJ4DYqdD2BtA7CQI+whYTUiQM5B9A8hWSM5IBJrB+API1klCEk9HYkPtBQFul8zigpzESoUAYwKuJQOUpFaUgGjn/ILKosz0jBIFR2AopSp45iXr6SgYGRiaMzCAwhyi+nMgOCwZxc4gxJrvMzDY7v////9uhJjXfgaGjUCdXDsRYhoWDAyC3AwMJ3YWJBYlgoWYgZgpLY2B4dNyBgbeSAYG4QtAPdHFacZGYHlGHicGBtZ7//9/VmNgYJ/MwPB3wv//vxf9//93MVDzHQaGA3kAFSFl7jXH0fsAAAA4ZVhJZk1NACoAAAAIAAGHaQAEAAAAAQAAABoAAAAAAAKgAgAEAAAAAQAAAFCgAwAEAAAAAQAAAFUAAAAA2sjhBQAAIoVJREFUeAHNf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FTkSuQmCC"/>
                        <text class="single_line award_number" :style="imageTipeAnimationStyle">{{animationText}}</text>
                        <text class="plus_number" :style="plusNumberAnimationStyle">{{plusAward}}</text>
                    </div>           
                </div>
        </div>
    </div>

</template>

<script>
    // 引入 animation 模块
    const animation = requireModule("animation");
    // 定义 keyframe 动画
    const keyframes = {
        'fluctuate': {
            "transform": [
                {
                    "p":0,
                    "v":"translateY(0rpx)"
                },
                {
                    "p":0.5,
                    "v":"translateY(-10rpx)"
                },
                {
                    "p":1.0,
                    "v":"translateY(0rpx)"
                }
            ]
        },
        'integralClicked': {
            "transform": [
                {
                    "p":0,
                    "v":"scale(1.0)"
                },
                {
                    "p":0.5,
                    "v":"scale(1.2)"
                },
                {
                    "p":1.0,
                    "v":"scale(1.0)"
                }
            ],
            "opacity": [
                {
                    "p":0,
                    "v":"1.0"
                },
                {
                    "p":0.3,
                    "v":"1.0"
                },
                {
                    "p":0.6,
                    "v":"0.0"
                },
                {
                    "p":0.9,
                    "v":"0.2"
                },
                {
                    "p":1.0,
                    "v":"1.0"
                }
            ]
        },
        'plusUp': {
            "transform": [
                {
                    "p":0,
                    "v":"translateY(0rpx)"
                },
                {
                    "p":1.0,
                    "v":"translateY(-48rpx)"
                }
            ],
            "opacity": [
                {
                    "p":0,
                    "v":"0"
                },
                {
                    "p":0.0873,
                    "v":"1.0"
                },
                {
                    "p":0.7205,
                    "v":"1.0"
                },
                {
                    "p":1.0,
                    "v":"0"
                }
            ]
        },
        'rightContentShow': {
            "transform": [
                {
                    "p":0,
                    "v":"scale(0)"
                },
                {
                    "p":0.5704,
                    "v":"scale(1.1)"
                },
                {
                    "p":1.0,
                    "v":"scale(1.0)"
                }
            ],
            "opacity": [
                {
                    "p":0,
                    "v":"1"
                },
                {
                    "p":1.0,
                    "v":"1"
                }
            ]
        }
    };

    // 加载 keyframe 动画
    animation.loadKeyframes(keyframes);    
    export default {
        data: {
            animationText:"123",
            plusAward: "123",
            shouldAnim: true
        },

        onCreated: function() {
            this.imageTipeAnimationStyle = {
                animationName: "fluctuate",
                animationDuration: "2000ms",
                animationDelay: "000ms",
                animationTimingFunction: "linear",
                animationIterationCount: "infinite",
            };
        },

        didAppear() {
            
        },

        methods: {            
            clickAnimation: function() {
                this.imageTipeAnimationStyle = {
                    animationName: "integralClicked",
                    animationDuration: "750ms",
                    animationDelay: "0ms",
                    animationTimingFunction: "ease-in-out",
                    animationIterationCount: "1",
                    animationFillMode: "backwards"
                };
                this.plusNumberAnimationStyle = {
                    opacity: 1.0,
                    animationName: "plusUp",
                    animationDuration: "350ms",
                    animationDelay: "0ms",
                    animationTimingFunction: "ease-in-out",
                    animationIterationCount: "1",
                    animationFillMode: "backwards"
                };
            }
        },
    }
</script>

<style>
    .card_root {
        display: flex;
        width: auto;
        flex-direction: row;
        padding-right: 24rpx;
        padding-left: 24rpx;
    }
    .white_bg {
        display: flex;
        flex-direction: row;
        justify-content: center;
        width: 100%;
        height: 144rpx;
        padding-right: 16rpx;
        padding-left: 16rpx;
        border-width: 0;
        border-radius: 16rpx;
        padding-top: 20px;
    }
    .left_div {
        display: flex;
        flex-direction: column;
        justify-content: center;
        flex:1;
    }
    .left_content {
        font-weight:600;
        font-size: 28rpx;
        color : #333333;
        width: auto;
    }
    .tips {
        margin-top:6rpx;
        display:flex;
        font-size: 24rpx;
        color : #99999999;
        width: auto;
    }
     .right_award {
        font-size: 40rpx;
        color : #999999;
        display: flex;
        width: auto;
        flex-shrink:0;
    }
    .right_content_div{
        display:flex;
        flex-direction: row;
        flex-shrink: 1;
        justify-content: center;        
    }
    .right_content_first{
        display:flex;
        flex-shrink: 0;
        flex-direction: row-reverse;
        position: absolute;
        right: 0rpx;
    }
    .right_div {
        padding-left:1rpx;
        display:flex;
        flex-direction: row;
        flex-shrink: 0;
        width: 272rpx;
        overflow: visible;
    }
    .image_tip{
        position: relative;
        justify-content:center;
        width:80rpx;
        height: 85rpx;
        margin-left: 20px;
    }
    .image_tip_wrapper {
        width:80rpx;
        height: 85rpx;
        position: absolute;
        top: 29rpx;
        right: 17rpx;
    }
    .image_tip_icon {
        width:80rpx;
        height: 85rpx;
    }
    .arrow{
        display:flex;
        flex-shrink: 0;
        align-self:center;
        color:#CCCCCC;
        font-size: 14pit;
        font-family: IconFont;
        margin-left: 6rpx;
        margin-right: -7rpx;
    } 
    .single_line {
        overflow: hidden;
        flex-shrink: 1;
        text-overflow:ellipsis;
        lines: 1;
    }
    .content_icon{
        width: 36rpx;
        height: 38rpx;
        align-self:center;
    }
    .award{
        margin-left: 10rpx;
        font-size:30rpx;
        color:#999999;
    }
    .award_number{
        position: absolute;
        top: 0;
        right: 0;
        left: 0;
        bottom: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size:36rpx;
        color:#806A00;
        text-align: center;
        line-height: 85rpx;
    }
    .plus_number{
        position: absolute;
        top: 0;
        right: 0;
        left: 0;
        bottom: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size:36rpx;
        color:#806A00;
        text-align: center;
        line-height: 85rpx;
        opacity: 0.0;
    }
</style>

如有需要,可单击此处 detailKeyFrame.zip 获取完整示例代码。