]> git.sesse.net Git - casparcg/blob - deploy/general/server/template/scene/crawler/crawler.scene
[scene] #564 Made a crawler example scene.
[casparcg] / deploy / general / server / template / scene / crawler / crawler.scene
1 <scene width="1920" height="1080" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/CasparCG/Server/2.1.0/core/producer/scene/scene.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2   <!--
3     An example crawler scene. Does not support the "tail" on screen at the same
4     time as the "head", but otherwise a good demonstration of combined use of
5     timeline for intro, outro animations and the frame variable for "infinite"
6     animations.
7    -->
8   <variables>
9     <variable type="string" id="text"       public="true">Needs "text", Use "speed" to set pixels per frame, Use "iterations" to specify how many times the crawler should repeat.</variable>
10     <variable type="number" id="speed"      public="true">4</variable>
11     <variable type="number" id="iterations" public="true">2</variable>
12
13     <!-- The scrolling is done without the timeline, only with the use of the global frame counter. -->
14     <variable type="number" id="text_num_pixels_wait">${20 * speed}</variable>
15     <variable type="number" id="scroll_distance">     ${layer.text.width + scene_width + variable.text_num_pixels_wait}</variable>
16     <variable type="number" id="current_text_pos">    ${(-frame * speed) % variable.scroll_distance + scene_width + variable.text_num_pixels_wait}</variable>
17     <variable type="number" id="current_iteration">   ${( frame * speed) / variable.scroll_distance}</variable>
18
19     <!-- Controlled by timeline. -->
20     <variable type="number" id="animation_pos_x">0</variable>
21   </variables>
22
23   <layers>
24     <layer id="plate">
25       <producer>RED</producer>
26       <x>${variable.animation_pos_x}</x>
27       <y>50</y>
28       <width>${scene_width}</width>
29       <height>60</height>
30       <adjustments>
31         <opacity>0.8</opacity>
32       </adjustments>
33     </layer>
34
35     <!-- Mask of text needed on out animation to not make the rest of the text visible -->
36     <layer id="mask">
37       <producer>WHITE</producer>
38       <x>${layer.plate.x}</x>
39       <y>${layer.plate.y}</y>
40       <width>${layer.plate.width}</width>
41       <height>${layer.plate.height}</height>
42       <is_key>true</is_key>
43     </layer>
44
45     <layer id="text">
46       <producer>[TEXT] "" 0 0 size 35 color white font Roboto-Regular</producer>
47       <x>${variable.current_text_pos + variable.animation_pos_x}</x>
48       <y>${layer.plate.y + layer.plate.height - 18}</y>
49       <parameters>
50         <text>${text}</text>
51       </parameters>
52     </layer>
53   </layers>
54
55   <marks>
56     <mark at="0" type="start" label="intro" />
57     <mark at="20" type="stop" />
58     <mark at="20" type="start" label="outro" />
59     <mark at="40" type="remove" />
60   </marks>
61
62   <tasks>
63     <goto_mark when="${variable.current_iteration &gt; iterations}" label="outro" />
64   </tasks>
65
66   <timelines>
67     <timeline variable="variable.animation_pos_x">
68       <keyframe at="0">${scene_width}</keyframe>
69       <keyframe at="20" easing="easeoutsine">0</keyframe>
70       <keyframe at="40" easing="easeoutsine">${-scene_width}</keyframe>
71     </timeline>
72     <timeline variable="layer.mask.adjustment.brightness">
73       <keyframe at="20">1</keyframe>
74       <keyframe at="40" easing="linear">0</keyframe>
75     </timeline>
76   </timelines>
77 </scene>