标题: [特效代码] 批处理特效之“看我倒背如流” [打印本页]
作者: batman 时间: 2013-8-16 23:47 标题: 批处理特效之“看我倒背如流”
本帖最后由 batman 于 2013-8-17 00:02 编辑
&&相信大家都知道倒背如流的意思吧,下面我们就用批来模拟对文本的倒背特效:- @echo off&setlocal enabledelayedexpansion
- rem 因论坛处理不了制表符,请将下面tab=后面的空格替换为制表符再运行代码
- set "tab= "
- for /l %%a in (10000,1,11000) do (
- set "tg=!tg!"&set "k=!k! "
- set "str=%%a"&set "code=!str:~1!!code!"
- )
- echo,&echo,┌────────────────────┐
- echo,&echo,└────────────────────┘
- echo,%tab%%tg:~,24%
- for /l %%a in (1,1,20) do (
- set /a bf=%%a*5,n=40-2*%%a
- set /p=!tg!│<nul
- for /l %%b in (1,1,%%a) do set /p=■<nul
- for %%i in (!n!) do set /p=!k:~,%%i!│文本阅读中,请稍等...!bf!%%<nul
- for /l %%c in (1,1,2000) do echo,>nul
- )
- cls&&echo,&echo,下面且看我倒背如流:&echo,
- for /f "tokens=1* delims=:" %%a in ('findstr /n .* a.txt') do (
- set "_%%a=%%b"&set /a n=%%a&echo,
- )
- for /l %%a in (%n%,-1,1) do (
- set /a s=n-%%a+1,m=s*10+12
- for /l %%b in (1,1,!s!) do echo,
- for %%b in (!m!) do echo,%tab%!tg:~,%%b!
- if defined _%%a (
- set "str=!_%%a!!_%%a!!_%%a!!_%%a!%code%"
- set /a sw=1!str:~4000,4! %% 10000
- for /l %%b in (1,1,!sw!) do (
- set /a kw=sw-%%b
- for %%c in (!kw!) do set /p=!k:~,%%c!!_%%a:~-%%b,%%b!<nul
- for /l %%c in (1,1,200) do echo,>nul
- set /p=!tg!<nul
- )
- )
- )
- pause>nul
复制代码
暂只适用于每行少于80个字符的纯英文文本,测试文本a.txt如下:- I loved you, and I probably still do,
-
- And for a while the feeling may remain...
-
- But let my love no longer trouble you,
-
- I do not wish to cause you any pain.
-
- I loved you; and the hopelessness I knew,
-
- The jealousy, the shyness - though in vain -
-
- Made up a love so tender and so true
复制代码
作者: 523066680 时间: 2013-8-17 08:28
本帖最后由 523066680 于 2013-8-17 09:20 编辑
闲情雅致啊。
很自然。做点阵渐显应该比cls刷新快。
已经不再用批处理弄这些了
作者: 112 时间: 2018-3-9 16:06
6666666666666
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |