首页 > 其他分享 >animation 巧用 delay 做 暂停动画

animation 巧用 delay 做 暂停动画

时间:2024-09-02 11:37:04浏览次数:4  
标签:ball const move inp delay animation 巧用

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>animation delay ball move</title>
    <style>
        .ball {
            --delay: 0s;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background-color: green;
            margin: 0 0 50px 0;
            animation: move 1s linear var(--delay) forwards paused;
            /* animation: name duration timing-function delay iteration-count direction fill-mode; */
            /* animation-fill-mode: forwards; */
            /* animation-play-state: paused; */
        }

        @keyframes move {
            100% {
                transform: translateX(200px);
            }

        }
    </style>
</head>

<body>
    <div class="container">
        <div class="ball"></div>
        <input type="range" name="" id="" min="0" max="1" step="0.01">
    </div>
    <!--  -->
    <script>
        const inp = document.querySelector('input')
        const ball = document.querySelector('.ball')
        const call = () => {
            ball.style.setProperty('--delay', `-${inp.value}s`)
        }
        inp.oninput = function () {
            call()
            console.log('rang-', inp.value);
        }
        call()
    </script>

</body>

</html>

标签:ball,const,move,inp,delay,animation,巧用
From: https://www.cnblogs.com/janty/p/18392417

相关文章

  • python动画教程|Animations using Matplotlib-官网教程程序解读
    随着python学习的深入,我们不可避免进入画图模块matplotlib,也不可避免会遇到制作动画的需求。【1】官网教程如何学习python制作动画,最简单的就是直奔官网:https://matplotlib.org/stable/users/explain/animations/animations.html#animations它给出很长的代码,下面是除引入nu......
  • three动画循环animate使用setAnimationLoop代替requestAnimationFrame
     初始化render时调用setAnimationLoopThree.renderer=newTHREE.WebGLRenderer({antialias:true});Three.renderer.setSize(window.innerWidth,window.innerHeight);Three.renderer.setAnimationLoop(animate);animate:functionanimate(){//requestAnimati......
  • three动画循环animate使用setAnimationLoop还是requestAnimationFrame
     初始化render时调用setAnimationLoopThree.renderer=newTHREE.WebGLRenderer({antialias:true});Three.renderer.setSize(window.innerWidth,window.innerHeight);Three.renderer.setAnimationLoop(animate);animate:functionanimate(){//requestAnimati......
  • JDK延迟队列 DelayQueue
    DelayQueue是JDK提供的一个无界队列,我们可以看到,DelayQueue队列中的元素需要实现Delayed,它只提供了一个方法,就是获取过期时间。用户的订单生成以后,设置过期时间比如30分钟,放入定义好的DelayQueue,然后创建一个线程,在线程中通过while(true)不断的从DelayQueue中获取过期的数据。......
  • 【数字时序】SI(信号完整性分析)/Cross talk(串扰)/Delta delay/噪声/消除delay和噪声
    之前分享的那一篇感觉理论太多了这一篇感觉更好,数字后端的带概念带数据还带经验指导,转过来收藏一哈。目录一、Crosstalk1.CrosstalkDelayEffects​编辑2.CrosstalkNoiseEffects​编辑二、CrosstalkAnalysis​编辑1.CrosstalkDelayAnalysis2.CrosstalkNois......
  • 延迟任务(DelayQueue,JDK开发)
    DelayQueue为了确定用户提交的播放记录是否变化,我们需要将播放记录保存为一个延迟任务,等待超过一个提交周期(20s)后检查播放进度。那么延迟任务该如何实现呢?1.1.延迟任务方案延迟任务的实现方案有很多,常见的有四类:DelayQueueRedissonMQ时间轮原理JDK自带延迟......
  • Swift 中的动画魔法:Core Animation 深度解析
    标题:Swift中的动画魔法:CoreAnimation深度解析引言在现代应用程序开发中,动画不仅增加了用户界面的吸引力,还提升了用户体验。Swift语言结合了CoreAnimation框架,为开发者提供了强大的工具来创建平滑和复杂的动画效果。本文将深入探讨如何在Swift中使用CoreAnimati......
  • I2C软件模拟与Delay寄存器延迟函数
    环境芯片:STM32F103ZET6库:来自HAL的STM32F1XX.H原理图有图可知SCL和SDA两条线接到了PB10和PB11Driver_I2C.h#ifndef__DRIVER_I2C#define__DRIVER_I2C#include"stm32f1xx.h"#include"Com_Delay.h"//定义拉高SCL引脚的宏操作#defineSCL_HIGH(GPIOB->ODR|......
  • Android T adout replace bootanimation
    idea_1:useotareplacebootanimation.zipidea_2:创建一个新的分区,(用于存放bootanimation.zip)可以让上层读写.idea_3:sucp前提条件:userdebug版本,默认关闭selLinux,可root//df查看设备分区情况,有些分区系统是不让去写的adbshellc4_t:/$dfFilesystem......
  • 【论文解读】Macroblock Level Rate Control for Low Delay H.264/AVC based Video Co
    级别:IEEE时间:2015作者:MinGao等机构:哈尔滨工业大学下载:MacroblockLevelRateControlforLowDelayH.264/AVCbasedVideoCommunication摘要算法目的:提出了一种针对低延迟H.264/AVC视频通信的宏块(MB)级别速率控制算法。算法基础:基于ρ域速率模型,该模型涉......