~mancvso/ubuntu-welcome-window/0.1

« back to all changes in this revision

Viewing changes to data/js/meet_ubuntu.js

  • Committer: dael99
  • Date: 2010-02-25 16:56:54 UTC
  • Revision ID: dael99@gmail.com-20100225165654-swc3l2c234pghmj8
maintenance

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
l = 1; m = 0; s = 0;
2
2
playing = false; lock_captions = true;
3
 
lessons = new Array();
4
3
audio = new Audio('../audio.oga');
 
4
 
5
5
/**
6
6
 * FIXME: add volume handler
7
7
 */
10
10
   new Effect.BlindDown('bottom_nav', {duration: 0.5, queue: 'end'});
11
11
   new Effect.Appear('mu_branding', {duration: 0.8, queue: 'end'});
12
12
   //prepare lessons
13
 
   
14
 
   lesson = {len: 123, start: 1}; lessons.push(lesson);
15
 
   lesson = {start: 124, len: 45}; lessons.push(lesson);
16
 
   echo(lessons[0].len);
17
 
   echo(lessons[1].start);
18
13
   new Effect.BlindDown('mu_cc',{delay: 0.2, duration: 0.3, queue: 'end', afterFinish: unlock_cc});
19
14
   setTimeout("toggle_play()", 1000); // wait a second to start animations
20
15
}
22
17
toggle_play = function(){
23
18
   if(!playing){
24
19
      tmr = setInterval(touch, 1000);
25
 
      ln = setInterval(line, 50);
26
 
      bl = setInterval(blank, 40);
27
20
      playing = true;
28
21
      replaceHtml('play_pause', '<img src="../media/pause.svg" width="24" height="24" />');
29
22
      audio.play();
30
23
   } else if(playing){
31
24
      clearInterval(tmr);
32
 
      clearInterval(ln);
33
 
      clearInterval(bl);
34
25
      playing = false;
35
26
      replaceHtml('play_pause', '<img src="../media/play.svg" width="24" height="24" />');
36
27
      audio.pause();
53
44
   (s < 10) ? (elapsed = m + ":0" + s) : (elapsed = m + ":" + s);
54
45
   
55
46
   t = m*60 + s; //represent time in integer
56
 
   for(i = 0; i < lessons.length; i++){
 
47
   /*for(i = 0; i < lessons.length; i++){
57
48
      //
58
49
      if (lessons[i].start == t){
59
50
        echo('change to lesson' + i);  
60
51
      }
61
 
   }
 
52
   }*/
62
53
   replaceHtml('mu_time_elapsed', elapsed); //update time
63
54
   alert('cc:'+ l + '|' + t); //ask for subtitles
64
55
   
119
110
   delete c;
120
111
   delete playing;
121
112
};
122
 
//from W3C specs examples
123
 
var context = document.getElementsByTagName('canvas')[0].getContext('2d');
124
 
var lastX = context.canvas.width * Math.random();
125
 
var lastY = context.canvas.height * Math.random();
126
 
var hue = 0;
127
 
function line() {
128
 
  context.save();
129
 
  context.translate(context.canvas.width/2, context.canvas.height/2);
130
 
  context.scale(0.9, 0.9);
131
 
  context.translate(-context.canvas.width/2, -context.canvas.height/2);
132
 
  context.beginPath();
133
 
  context.lineWidth = 5 + Math.random() * 10;
134
 
  context.moveTo(lastX, lastY);
135
 
  lastX = context.canvas.width * Math.random();
136
 
  lastY = context.canvas.height * Math.random();
137
 
  context.bezierCurveTo(context.canvas.width * Math.random(),
138
 
                        context.canvas.height * Math.random(),
139
 
                        context.canvas.width * Math.random(),
140
 
                        context.canvas.height * Math.random(),
141
 
                        lastX, lastY);
142
 
  hue = hue + 10 * Math.random();
143
 
  context.strokeStyle = 'hsl(' + hue + ', 50%, 50%)';
144
 
  context.shadowColor = 'white';
145
 
  context.shadowBlur = 10;
146
 
  context.stroke();
147
 
  context.restore();
148
 
}
149
 
 
150
 
function blank() {
151
 
  context.fillStyle = 'rgba(0,0,0,0.1)';
152
 
  context.fillRect(0, 0, context.canvas.width, context.canvas.height);
153
 
}
154
 
 
155
 
 
156
 
startTimeline(); //auto-play animation
 
 
b'\\ No newline at end of file'
 
113
 
 
114
//startTimeline(); //auto-play animation
 
 
b'\\ No newline at end of file'