= 9. Working with timelines = Timelines will allow the authors of Sophie books to create complex books with reader-triggered actions that change over time. The current timeline model in Sophie 2 is loop-based; it is provisional and provides only a fraction of the capabilities of timelines to come in the final version of Sophie 2. To edit timelines in Sophie, you need to open the timeline interface, which is the bottom flap. The timeline interface will show the timeline for the current page (if you have no frames selected) or for the frame or group currently selected. Every page in a Sophie book has a master timeline which shows all the frames on the page. Each frame (or group of frames) has its own timeline as well. The page, frames, and groups of frames have timeline halos, which will open up the timeline HUD for the page, frame, or group of frames. Currently, timelines can not be triggered by the book; they start automatically when a page that uses a timeline is opened and loop. Much more timeline functionality will be added in the future to Sophie. == The page timeline == The page timeline appears in the bottom flap when the page is selected. The page timeline includes channels for every frame on the current page. Here's how the page timeline of a page with two frames might look: [[Image(source:/branches/private/danvisel/sophie2-platform/doc/userdoc-images/RELEASE_12/PageTimeline.png)]] You can set the resolution of the timeline with the controls in the bottom left of the timeline interface; it's currently set to '''500 ms'''. The slider can be dragged back and forth, which will show what the page looks like at that point in time. You can adjust frames' visibility and position over time in this way. You can move frames around on the page: if you move the slider to 0:10, then move a frame from the upper left corner to the lower right corner, when the timeline is played back, the frame will move from the upper left corner to the lower right corner at 0:10. You can also use the page timeline to change visibility: a frame can be made to appear from 0:00-0:10, then disappear, then reappear at 0:20. To do this, move the slider to 0:10. Then select the frame you want to hide; open the frame's appearance HUD: [[Image(source:/branches/private/danvisel/sophie2-platform/doc/userdoc-images/RELEASE_12/BorderFillHUD.png)]] Uncheck the checkbox that says '''Visibility'''. Then move the slider on the timeline to 0:20; turn '''Visibility''' back on. When the timeline is played back, the frame will disappear from 0:10 to 0:20. You can set the length of the page timeline by clicking the page's timeline halo to open the page's timeline HUD. The page timeline HUD might look like this: [[Image(source:/branches/private/danvisel/sophie2-platform/doc/userdoc-images/RELEASE_12/PageTimelineHUD.png)]] The most importing setting is the number under '''Main''': this is the length of the looping part of the timeline. By default this is set to ten minutes (the value used here is currently in animation frames, rather than in seconds); you can increase or decrease this number to change the amount of time in the main loop. Adding values to the '''Intro''' or '''Outro''' fields will add time before or after the timeline's main loop. If these numbers are very high, for example, the timeline's loop might not play. Every frame on the page is also listed in the page timeline HUD. Beside each of their names is a drop-down menu which lists which part of the timeline will play and how long that section of the timeline is. You can change the lengths of individual frame timelines here. == The frame timeline == Each frame's timeline appears in the bottom flap when the frame is selected. The frame timeline looks like the page timeline, but it only shows the selected frame: [[Image(source:/branches/private/danvisel/sophie2-platform/doc/userdoc-images/RELEASE_12/FrameTimeline.png)]] Like the page timeline, you can set the resolution of the timeline with the controls in the bottom left of the timeline interface. This timeline has two channels: one for visibility and one for position. If the slider is moved and the frame's visibility or position is changed, the channels will reflect this. This timeline has a shorter length than the page timeline shown above. You can set the length of the frame's timeline in the frame timeline HUD. Click the frame's timeline halo to open its timeline HUD, which looks like this: [[Image(source:/branches/private/danvisel/sophie2-platform/doc/userdoc-images/RELEASE_12/FrameTimelineHUD.png)]] The value in '''MAIN''' controls the length of the frame's timeline. (This value is in animation frames, not in seconds.) If this length is less than the length of the page's timeline, the frame's timeline actions will loop when the page is played. The '''INTRO''' and '''OUTRO''' values control how much time is added before and after the main actions of the frame's timeline. == Playing back a timeline == When a book with timelines is opened in Sophie Reader or in Preview mode, the timeline on a page starts playing as soon as the user turns to that page. Currently the timeline loops indefinitely; this will change in the future.