This tutorial explores how to work with time in interactive systems using TouchDesigner. The Timer CHOP is one of the most powerful operators for managing time-based behaviors in installations and experiences.
Understanding the Timer CHOP
The Timer CHOP provides several built-in channels for tracking time:
- Timer Fraction - A 0 to 1 representation of elapsed time
- Ready - Indicates the timer is initialized and waiting to start
- Running - Shows when the timer is actively counting (enable on Outputs page)
- Done - Signals when the timer has completed
Basic Timer Setup
- Add a Timer CHOP to your network
- Set the duration (e.g., 2 seconds)
- Start the timer to see the fraction run from 0 to 1
- Initialize to reset to ready state
Building a Timer State Indicator
To create a visual representation of timer states:
Step 1: Extract State Channels
Add a Select CHOP to isolate the three state channels:
- ready
- running
- done
Step 2: Combine Channels
Add a Fan CHOP and set it to “fan in” mode. This combines the three input channels into a single output channel where:
- 0 = Ready state
- 1 = Running state
- 2 = Done state
Step 3: Rename for Clarity
Add a Rename CHOP to give the channel a meaningful name like “timer_state”.
Step 4: Create Visual Feedback
- Add three Text TOPs with labels: “Standby”, “Running”, “Done”
- Connect all three to a Switch TOP
- Make the Null CHOP viewer active, drag the channel onto the Switch TOP’s index parameter
- Set as CHOP reference
Now the display automatically switches based on timer state - useful for tracking installation or experience states.
Creating Cycling Animations
The Timer CHOP’s cycle parameter enables repeating animations.
Building a Text Ticker
- Add a Text TOP with “Hello World” text
- Set resolution to 1280x720 and font size to 100
- Add a Transform TOP connected to the Text TOP
- Connect the timer fraction to the Transform’s TX parameter
- On the Transform TOP’s Tile page, set Extend to “repeat”
Cycle Options
Fixed Cycles:
- Enable the cycle parameter
- Set maximum cycles (e.g., 4)
- Animation runs the specified number of times then stops
Perpetual Cycling:
- Turn off cycle limit
- Animation runs indefinitely until manually stopped
Stopping Cycled Animations
Two methods to end a cycling animation:
Go to Done:
- Use the “go to done” parameter
- Immediately snaps to the end position
Exit Segment at End:
- Use “exit segment at end of cycle”
- Completes the current cycle before stopping
- Ideal for loading animations that need graceful endings
Interactive Control with Buttons
Start Button Setup
- Add a Button Component
- Label it “Start” and set to momentary mode
- Connect the button output to the Timer’s second input (start trigger)
Exit Cycle Button with Parameter Execute DAT
For callback-based control:
- Add another Button Component labeled “Exit Cycle” (momentary)
- Add a Parameter Execute DAT
- Set the operator to watch as your button
- Set the parameter to “value0”
- Add this Python code in onValueChange:
if par.eval():
op('timer2').par.exitsegaliasendcycle.pulse()
The pulse() method simulates clicking the pulse parameter, allowing programmatic control of the exit cycle behavior.
Key Concepts
- Timer CHOP is essential for time-based interactive systems
- State channels (ready, running, done) help track timer status
- Fan CHOP can combine multiple state channels into a single index
- Cycle parameter enables repeating animations
- Exit segment at end provides graceful animation completion
- Parameter Execute DAT enables callback-based timer control
- pulse() method programmatically triggers pulse parameters
These techniques form the foundation for building time-aware interactive installations and experiences in TouchDesigner.
本教程探讨如何在TouchDesigner中处理交互系统的时间。Timer CHOP是管理装置和体验中基于时间行为的最强大操作符之一。
理解Timer CHOP
Timer CHOP提供了几个用于跟踪时间的内置通道:
- Timer Fraction - 经过时间的0到1表示
- Ready - 表示计时器已初始化并等待启动
- Running - 显示计时器正在计数(在Outputs页面启用)
- Done - 表示计时器已完成
基本计时器设置
- 在网络中添加Timer CHOP
- 设置持续时间(例如2秒)
- 启动计时器查看分数从0运行到1
- 初始化以重置到就绪状态
构建计时器状态指示器
创建计时器状态的可视化表示:
步骤1:提取状态通道
添加Select CHOP来隔离三个状态通道:
- ready
- running
- done
步骤2:合并通道
添加Fan CHOP并设置为”fan in”模式。这将三个输入通道合并为单个输出通道,其中:
- 0 = 就绪状态
- 1 = 运行状态
- 2 = 完成状态
步骤3:重命名以提高清晰度
添加Rename CHOP为通道赋予有意义的名称,如”timer_state”。
步骤4:创建视觉反馈
- 添加三个Text TOP,标签分别为:“Standby”、“Running”、“Done”
- 将三个都连接到Switch TOP
- 使Null CHOP查看器激活,将通道拖到Switch TOP的index参数上
- 设置为CHOP引用
现在显示会根据计时器状态自动切换——这对于跟踪装置或体验状态非常有用。
创建循环动画
Timer CHOP的cycle参数可以实现重复动画。
构建文字滚动条
- 添加带有”Hello World”文本的Text TOP
- 设置分辨率为1280x720,字体大小为100
- 添加连接到Text TOP的Transform TOP
- 将计时器分数连接到Transform的TX参数
- 在Transform TOP的Tile页面,将Extend设置为”repeat”
循环选项
固定循环:
- 启用cycle参数
- 设置最大循环次数(例如4次)
- 动画运行指定次数后停止
永久循环:
- 关闭循环限制
- 动画无限运行直到手动停止
停止循环动画
两种结束循环动画的方法:
跳转到完成:
- 使用”go to done”参数
- 立即跳转到结束位置
在周期结束时退出:
- 使用”exit segment at end of cycle”
- 完成当前周期后停止
- 适合需要优雅结束的加载动画
使用按钮进行交互控制
启动按钮设置
- 添加Button Component
- 标记为”Start”并设置为瞬时模式
- 将按钮输出连接到Timer的第二个输入(启动触发器)
使用Parameter Execute DAT的退出循环按钮
用于基于回调的控制:
- 添加另一个标记为”Exit Cycle”的Button Component(瞬时)
- 添加Parameter Execute DAT
- 将要监视的操作符设置为你的按钮
- 将参数设置为”value0”
- 在onValueChange中添加此Python代码:
if par.eval():
op('timer2').par.exitsegaliasendcycle.pulse()
pulse()方法模拟点击脉冲参数,允许以编程方式控制退出循环行为。
核心概念
- Timer CHOP对于基于时间的交互系统至关重要
- 状态通道(ready、running、done)帮助跟踪计时器状态
- Fan CHOP可以将多个状态通道合并为单个索引
- Cycle参数启用重复动画
- Exit segment at end提供优雅的动画完成
- Parameter Execute DAT启用基于回调的计时器控制
- pulse()方法以编程方式触发脉冲参数
这些技术构成了在TouchDesigner中构建时间感知交互装置和体验的基础。